@@ -42,7 +42,7 @@ pub trait WriteReady {
42
42
type Ok ;
43
43
44
44
/// The type of failures yielded by this trait.
45
- type Err ;
45
+ type Err : std :: error :: Error + Send + Sync ;
46
46
47
47
/// Check if the underlying API can be written to.
48
48
fn poll_write_ready ( & mut self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
@@ -54,7 +54,7 @@ pub trait ReadReady {
54
54
type Ok ;
55
55
56
56
/// The type of failures yielded by this trait.
57
- type Err ;
57
+ type Err : std :: error :: Error + Send + Sync ;
58
58
59
59
/// Check if the underlying API can be read from.
60
60
fn poll_read_ready ( & mut self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
@@ -73,8 +73,27 @@ pub trait Ready {
73
73
type Ok ;
74
74
75
75
/// The type of failures yielded by this trait.
76
- type Err ;
76
+ type Err : std :: error :: Error + Send + Sync ;
77
77
78
78
/// Check if the stream can be read from.
79
79
fn poll_ready ( & mut self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
80
80
}
81
+
82
+ /// Extract an error from the underlying struct that isn't propagated through
83
+ /// regular channels.
84
+ ///
85
+ /// This is common in `TcpListener` / `UdsStream` structs where this trait can
86
+ /// be used to access the `SO_ERROR` option on the socket.
87
+ ///
88
+ /// Both `Ok` and `Err` are error types. If no error exists `take_error` should
89
+ /// return `Ok(None)`.
90
+ pub trait TakeError {
91
+ /// The type of successful values yielded by this trait.
92
+ type Ok : std:: error:: Error + Send + Sync ;
93
+
94
+ /// The type of failures yielded by this trait.
95
+ type Err : std:: error:: Error + Send + Sync ;
96
+
97
+ /// Return an underlying error value of the struct.
98
+ fn take_error ( & self ) -> Result < Option < Self :: Ok > , Self :: Err > ;
99
+ }
0 commit comments