@@ -49,7 +49,7 @@ use core::pin::Pin;
49
49
#[ must_use = "sinks do nothing unless polled" ]
50
50
pub trait Sink < Item > {
51
51
/// The type of value produced by the sink when an error occurs.
52
- type SinkError ;
52
+ type Error ;
53
53
54
54
/// Attempts to prepare the `Sink` to receive a value.
55
55
///
@@ -63,7 +63,7 @@ pub trait Sink<Item> {
63
63
///
64
64
/// In most cases, if the sink encounters an error, the sink will
65
65
/// permanently be unable to receive items.
66
- fn poll_ready ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > ;
66
+ fn poll_ready ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > ;
67
67
68
68
/// Begin the process of sending a value to the sink.
69
69
/// Each call to this function must be preceded by a successful call to
@@ -85,7 +85,7 @@ pub trait Sink<Item> {
85
85
/// In most cases, if the sink encounters an error, the sink will
86
86
/// permanently be unable to receive items.
87
87
fn start_send ( self : Pin < & mut Self > , item : Item )
88
- -> Result < ( ) , Self :: SinkError > ;
88
+ -> Result < ( ) , Self :: Error > ;
89
89
90
90
/// Flush any remaining output from this sink.
91
91
///
@@ -99,7 +99,7 @@ pub trait Sink<Item> {
99
99
///
100
100
/// In most cases, if the sink encounters an error, the sink will
101
101
/// permanently be unable to receive items.
102
- fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > ;
102
+ fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > ;
103
103
104
104
/// Flush any remaining output and close this sink, if necessary.
105
105
///
@@ -112,25 +112,25 @@ pub trait Sink<Item> {
112
112
///
113
113
/// If this function encounters an error, the sink should be considered to
114
114
/// have failed permanently, and no more `Sink` methods should be called.
115
- fn poll_close ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > ;
115
+ fn poll_close ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > ;
116
116
}
117
117
118
118
impl < S : ?Sized + Sink < Item > + Unpin , Item > Sink < Item > for & mut S {
119
- type SinkError = S :: SinkError ;
119
+ type Error = S :: Error ;
120
120
121
- fn poll_ready ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
121
+ fn poll_ready ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
122
122
Pin :: new ( & mut * * self ) . poll_ready ( cx)
123
123
}
124
124
125
- fn start_send ( mut self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: SinkError > {
125
+ fn start_send ( mut self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: Error > {
126
126
Pin :: new ( & mut * * self ) . start_send ( item)
127
127
}
128
128
129
- fn poll_flush ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
129
+ fn poll_flush ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
130
130
Pin :: new ( & mut * * self ) . poll_flush ( cx)
131
131
}
132
132
133
- fn poll_close ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
133
+ fn poll_close ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
134
134
Pin :: new ( & mut * * self ) . poll_close ( cx)
135
135
}
136
136
}
@@ -140,21 +140,21 @@ where
140
140
P : DerefMut + Unpin ,
141
141
P :: Target : Sink < Item > ,
142
142
{
143
- type SinkError = <P :: Target as Sink < Item > >:: SinkError ;
143
+ type Error = <P :: Target as Sink < Item > >:: Error ;
144
144
145
- fn poll_ready ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
145
+ fn poll_ready ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
146
146
self . get_mut ( ) . as_mut ( ) . poll_ready ( cx)
147
147
}
148
148
149
- fn start_send ( self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: SinkError > {
149
+ fn start_send ( self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: Error > {
150
150
self . get_mut ( ) . as_mut ( ) . start_send ( item)
151
151
}
152
152
153
- fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
153
+ fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
154
154
self . get_mut ( ) . as_mut ( ) . poll_flush ( cx)
155
155
}
156
156
157
- fn poll_close ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
157
+ fn poll_close ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
158
158
self . get_mut ( ) . as_mut ( ) . poll_close ( cx)
159
159
}
160
160
}
@@ -165,65 +165,65 @@ mod if_alloc {
165
165
use futures_core:: never:: Never ;
166
166
167
167
impl < T > Sink < T > for alloc:: vec:: Vec < T > {
168
- type SinkError = Never ;
168
+ type Error = Never ;
169
169
170
- fn poll_ready ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
170
+ fn poll_ready ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
171
171
Poll :: Ready ( Ok ( ( ) ) )
172
172
}
173
173
174
- fn start_send ( self : Pin < & mut Self > , item : T ) -> Result < ( ) , Self :: SinkError > {
174
+ fn start_send ( self : Pin < & mut Self > , item : T ) -> Result < ( ) , Self :: Error > {
175
175
// TODO: impl<T> Unpin for Vec<T> {}
176
176
unsafe { self . get_unchecked_mut ( ) } . push ( item) ;
177
177
Ok ( ( ) )
178
178
}
179
179
180
- fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
180
+ fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
181
181
Poll :: Ready ( Ok ( ( ) ) )
182
182
}
183
183
184
- fn poll_close ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
184
+ fn poll_close ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
185
185
Poll :: Ready ( Ok ( ( ) ) )
186
186
}
187
187
}
188
188
189
189
impl < T > Sink < T > for alloc:: collections:: VecDeque < T > {
190
- type SinkError = Never ;
190
+ type Error = Never ;
191
191
192
- fn poll_ready ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
192
+ fn poll_ready ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
193
193
Poll :: Ready ( Ok ( ( ) ) )
194
194
}
195
195
196
- fn start_send ( self : Pin < & mut Self > , item : T ) -> Result < ( ) , Self :: SinkError > {
196
+ fn start_send ( self : Pin < & mut Self > , item : T ) -> Result < ( ) , Self :: Error > {
197
197
// TODO: impl<T> Unpin for Vec<T> {}
198
198
unsafe { self . get_unchecked_mut ( ) } . push_back ( item) ;
199
199
Ok ( ( ) )
200
200
}
201
201
202
- fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
202
+ fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
203
203
Poll :: Ready ( Ok ( ( ) ) )
204
204
}
205
205
206
- fn poll_close ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
206
+ fn poll_close ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
207
207
Poll :: Ready ( Ok ( ( ) ) )
208
208
}
209
209
}
210
210
211
211
impl < S : ?Sized + Sink < Item > + Unpin , Item > Sink < Item > for alloc:: boxed:: Box < S > {
212
- type SinkError = S :: SinkError ;
212
+ type Error = S :: Error ;
213
213
214
- fn poll_ready ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
214
+ fn poll_ready ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
215
215
Pin :: new ( & mut * * self ) . poll_ready ( cx)
216
216
}
217
217
218
- fn start_send ( mut self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: SinkError > {
218
+ fn start_send ( mut self : Pin < & mut Self > , item : Item ) -> Result < ( ) , Self :: Error > {
219
219
Pin :: new ( & mut * * self ) . start_send ( item)
220
220
}
221
221
222
- fn poll_flush ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
222
+ fn poll_flush ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
223
223
Pin :: new ( & mut * * self ) . poll_flush ( cx)
224
224
}
225
225
226
- fn poll_close ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: SinkError > > {
226
+ fn poll_close ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
227
227
Pin :: new ( & mut * * self ) . poll_close ( cx)
228
228
}
229
229
}
0 commit comments