From c30fa62ddafa3fdf9a2af96ed2d2c6a20397e7c2 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 7 Feb 2018 10:42:27 -0800 Subject: Remove `framed` fn from `UdpSocket` (#116) Instead, use `UdpFramed::new` to create a framed wrapper around the UDP socket. --- examples/connect.rs | 4 ++-- examples/udp-codec.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/connect.rs b/examples/connect.rs index 275864d1..26614b96 100644 --- a/examples/connect.rs +++ b/examples/connect.rs @@ -170,7 +170,7 @@ mod udp { use futures::{Future, Stream}; use futures::future::Executor; use futures_cpupool::CpuPool; - use tokio::net::UdpSocket; + use tokio::net::{UdpSocket, UdpFramed}; use codec::Bytes; pub fn connect(&addr: &SocketAddr, @@ -192,7 +192,7 @@ mod udp { // this UDP socket into a framed sink/stream which operates over // discrete values. In this case we're working with *pairs* of socket // addresses and byte buffers. - let (sink, stream) = udp.framed(Bytes).split(); + let (sink, stream) = UdpFramed::new(udp, Bytes).split(); // All bytes from `stdin` will go to the `addr` specified in our // argument list. Like with TCP this is spawned concurrently diff --git a/examples/udp-codec.rs b/examples/udp-codec.rs index a2429e49..be686d63 100644 --- a/examples/udp-codec.rs +++ b/examples/udp-codec.rs @@ -17,7 +17,7 @@ use std::net::SocketAddr; use futures::{Future, Stream, Sink}; use futures::future::Executor; use futures_cpupool::CpuPool; -use tokio::net::UdpSocket; +use tokio::net::{UdpSocket, UdpFramed}; use tokio_io::codec::BytesCodec; fn main() { @@ -34,8 +34,8 @@ fn main() { // We're parsing each socket with the `LineCodec` defined above, and then we // `split` each codec into the sink/stream halves. - let (a_sink, a_stream) = a.framed(BytesCodec::new()).split(); - let (b_sink, b_stream) = b.framed(BytesCodec::new()).split(); + let (a_sink, a_stream) = UdpFramed::new(a, BytesCodec::new()).split(); + let (b_sink, b_stream) = UdpFramed::new(b, BytesCodec::new()).split(); // Start off by sending a ping from a to b, afterwards we just print out // what they send us and continually send pings -- cgit v1.2.3