File tree Expand file tree Collapse file tree 10 files changed +10
-46
lines changed Expand file tree Collapse file tree 10 files changed +10
-46
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,6 @@ path = "basic.rs"
4343name = " chat"
4444path = " chat.rs"
4545
46- [[example ]]
47- name = " connect"
48- path = " connect.rs"
49-
5046[[example ]]
5147name = " echo-udp"
5248path = " echo-udp.rs"
@@ -75,34 +71,10 @@ path = "tinydb.rs"
7571name = " udp-client"
7672path = " udp-client.rs"
7773
78- [[example ]]
79- name = " udp-codec"
80- path = " udp-codec.rs"
81-
8274[[example ]]
8375name = " tinyhttp"
8476path = " tinyhttp.rs"
8577
86- [[example ]]
87- name = " custom-executor"
88- path = " custom-executor.rs"
89-
90- [[example ]]
91- name = " custom-executor-tokio-context"
92- path = " custom-executor-tokio-context.rs"
93-
94- [[example ]]
95- name = " named-pipe"
96- path = " named-pipe.rs"
97-
98- [[example ]]
99- name = " named-pipe-ready"
100- path = " named-pipe-ready.rs"
101-
102- [[example ]]
103- name = " named-pipe-multi-client"
104- path = " named-pipe-multi-client.rs"
105-
10678[[example ]]
10779name = " hyper-server"
10880path = " hyper-server/main.rs"
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};
66async fn main ( ) -> io:: Result < ( ) > {
77 let listener = TcpListener :: bind ( "127.0.0.1:8080" ) . await ?;
88 println ! ( "{listener:#?}" ) ;
9-
9+
1010 loop {
1111 let ( mut stream, addr) = listener. accept ( ) . await ?;
1212 println ! ( "[INCOMING] {addr:?}" ) ;
Original file line number Diff line number Diff line change 2222
2323#![ warn( rust_2018_idioms) ]
2424
25- use tokio:: io:: copy_bidirectional;
2625use nio:: net:: { TcpListener , TcpStream } ;
26+ use tokio:: io:: copy_bidirectional;
2727
2828use futures:: FutureExt ;
2929use std:: env;
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ use std::path::Path;
1717/// # Ok(())
1818/// # }
1919/// ```
20-
2120pub async fn copy ( from : impl AsRef < Path > , to : impl AsRef < Path > ) -> Result < u64 , std:: io:: Error > {
2221 let from = from. as_ref ( ) . to_owned ( ) ;
2322 let to = to. as_ref ( ) . to_owned ( ) ;
Original file line number Diff line number Diff line change @@ -240,9 +240,6 @@ where
240240{
241241 match crate :: task:: spawn_blocking ( f) . await {
242242 Ok ( res) => res,
243- Err ( _) => Err ( io:: Error :: new (
244- io:: ErrorKind :: Other ,
245- "background task failed" ,
246- ) ) ,
243+ Err ( _) => Err ( io:: Error :: other ( "background task failed" ) ) ,
247244 }
248245}
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ impl Event {
6565 let _ = self . readiness . fetch_update ( AcqRel , Acquire , |state| {
6666 let mut state = ReadinessVersion :: from_usize ( state) ;
6767 state. version = state. version . wrapping_add ( 1 ) ;
68- state. readiness = state . readiness | readiness;
68+ state. readiness |= readiness;
6969 Some ( state. into_usize ( ) )
7070 } ) ;
7171 self . waker . wake ( ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ macro_rules! cfg_unix {
3737 }
3838}
3939
40-
4140macro_rules! cfg_aio {
4241 ( $( $item: item) * ) => {
4342 $(
Original file line number Diff line number Diff line change @@ -157,13 +157,10 @@ impl fmt::Debug for JoinError {
157157
158158impl From < JoinError > for io:: Error {
159159 fn from ( src : JoinError ) -> io:: Error {
160- io:: Error :: new (
161- io:: ErrorKind :: Other ,
162- match src. repr {
163- Repr :: Cancelled => "task was cancelled" ,
164- Repr :: Panic ( _) => "task panicked" ,
165- } ,
166- )
160+ io:: Error :: other ( match src. repr {
161+ Repr :: Cancelled => "task was cancelled" ,
162+ Repr :: Panic ( _) => "task panicked" ,
163+ } )
167164 }
168165}
169166
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ mod timeout;
44pub ( crate ) mod timer;
55
66pub use error:: TimeoutError ;
7+ pub use std:: time:: Duration ;
78pub use timeout:: { timeout, Timeout } ;
89pub use timer:: { sleep, Sleep } ;
9- pub use std:: time:: Duration ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ impl PartialEq for Timer {
3636}
3737impl PartialOrd for Timer {
3838 fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
39- Some ( other . deadline . cmp ( & self . deadline ) )
39+ Some ( self . cmp ( other ) )
4040 }
4141}
4242impl Ord for Timer {
You can’t perform that action at this time.
0 commit comments