summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-11-20 11:29:32 -0800
committerGitHub <noreply@github.com>2019-11-20 11:29:32 -0800
commit15dce2d11ad849e25f0336f09fdb1cca7e405a9e (patch)
treee93302cde6de6e7778fa2d842ffddebbd199ac70 /examples
parentd4fec2c5d628b180226f6ab3005aa3e5845f1929 (diff)
net: flatten `split` mod (#1797)
The misc `split` types (`ReadHalf`, `WriteHalf`, `SendHalf`, `RecvHalf`) are moved up a module and the `*::split` module is removed.
Diffstat (limited to 'examples')
-rw-r--r--examples/connect.rs15
1 files changed, 8 insertions, 7 deletions
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<Item = Result<Vec<u8>, 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<Vec<u8>, Error = io::Error> + Unpin,
- reader: &mut UdpSocketRecvHalf,
+ reader: &mut RecvHalf,
) -> Result<(), io::Error> {
loop {
let mut buf = vec![0; 1024];