From 15dce2d11ad849e25f0336f09fdb1cca7e405a9e Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 20 Nov 2019 11:29:32 -0800 Subject: net: flatten `split` mod (#1797) The misc `split` types (`ReadHalf`, `WriteHalf`, `SendHalf`, `RecvHalf`) are moved up a module and the `*::split` module is removed. --- examples/connect.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/connect.rs b/examples/connect.rs index cb003d9d..34b3488d 100644 --- a/examples/connect.rs +++ b/examples/connect.rs @@ -115,12 +115,13 @@ mod tcp { } mod udp { + use tokio::net::udp::{RecvHalf, SendHalf}; + use tokio::net::UdpSocket; + use futures::{future, Sink, SinkExt, Stream, StreamExt}; - use std::{error::Error, io, net::SocketAddr}; - use tokio::net::udp::{ - split::{UdpSocketRecvHalf, UdpSocketSendHalf}, - UdpSocket, - }; + use std::error::Error; + use std::io; + use std::net::SocketAddr; pub async fn connect( addr: &SocketAddr, @@ -146,7 +147,7 @@ mod udp { async fn send( mut stdin: impl Stream, io::Error>> + Unpin, - writer: &mut UdpSocketSendHalf, + writer: &mut SendHalf, ) -> Result<(), io::Error> { while let Some(item) = stdin.next().await { let buf = item?; @@ -158,7 +159,7 @@ mod udp { async fn recv( mut stdout: impl Sink, Error = io::Error> + Unpin, - reader: &mut UdpSocketRecvHalf, + reader: &mut RecvHalf, ) -> Result<(), io::Error> { loop { let mut buf = vec![0; 1024]; -- cgit v1.2.3