@@ -49,7 +49,7 @@ use core::pin::Pin;
4949#[ must_use = "sinks do nothing unless polled" ]
5050pub trait Sink < Item > {
5151 /// The type of value produced by the sink when an error occurs.
52- type SinkError ;
52+ type Error ;
5353
5454 /// Attempts to prepare the `Sink` to receive a value.
5555 ///
@@ -63,7 +63,7 @@ pub trait Sink<Item> {
6363 ///
6464 /// In most cases, if the sink encounters an error, the sink will
6565 /// 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 > > ;
6767
6868 /// Begin the process of sending a value to the sink.
6969 /// Each call to this function must be preceded by a successful call to
@@ -85,7 +85,7 @@ pub trait Sink<Item> {
8585 /// In most cases, if the sink encounters an error, the sink will
8686 /// permanently be unable to receive items.
8787 fn start_send ( self : Pin < & mut Self > , item : Item )
88- -> Result < ( ) , Self :: SinkError > ;
88+ -> Result < ( ) , Self :: Error > ;
8989
9090 /// Flush any remaining output from this sink.
9191 ///
@@ -99,7 +99,7 @@ pub trait Sink<Item> {
9999 ///
100100 /// In most cases, if the sink encounters an error, the sink will
101101 /// 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 > > ;
103103
104104 /// Flush any remaining output and close this sink, if necessary.
105105 ///
@@ -112,25 +112,25 @@ pub trait Sink<Item> {
112112 ///
113113 /// If this function encounters an error, the sink should be considered to
114114 /// 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 > > ;
116116}
117117
118118impl < S : ?Sized + Sink < Item > + Unpin , Item > Sink < Item > for & mut S {
119- type SinkError = S :: SinkError ;
119+ type Error = S :: Error ;
120120
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 > > {
122122 Pin :: new ( & mut * * self ) . poll_ready ( cx)
123123 }
124124
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 > {
126126 Pin :: new ( & mut * * self ) . start_send ( item)
127127 }
128128
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 > > {
130130 Pin :: new ( & mut * * self ) . poll_flush ( cx)
131131 }
132132
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 > > {
134134 Pin :: new ( & mut * * self ) . poll_close ( cx)
135135 }
136136}
@@ -140,21 +140,21 @@ where
140140 P : DerefMut + Unpin ,
141141 P :: Target : Sink < Item > ,
142142{
143- type SinkError = <P :: Target as Sink < Item > >:: SinkError ;
143+ type Error = <P :: Target as Sink < Item > >:: Error ;
144144
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 > > {
146146 self . get_mut ( ) . as_mut ( ) . poll_ready ( cx)
147147 }
148148
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 > {
150150 self . get_mut ( ) . as_mut ( ) . start_send ( item)
151151 }
152152
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 > > {
154154 self . get_mut ( ) . as_mut ( ) . poll_flush ( cx)
155155 }
156156
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 > > {
158158 self . get_mut ( ) . as_mut ( ) . poll_close ( cx)
159159 }
160160}
@@ -165,65 +165,65 @@ mod if_alloc {
165165 use futures_core:: never:: Never ;
166166
167167 impl < T > Sink < T > for alloc:: vec:: Vec < T > {
168- type SinkError = Never ;
168+ type Error = Never ;
169169
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 > > {
171171 Poll :: Ready ( Ok ( ( ) ) )
172172 }
173173
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 > {
175175 // TODO: impl<T> Unpin for Vec<T> {}
176176 unsafe { self . get_unchecked_mut ( ) } . push ( item) ;
177177 Ok ( ( ) )
178178 }
179179
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 > > {
181181 Poll :: Ready ( Ok ( ( ) ) )
182182 }
183183
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 > > {
185185 Poll :: Ready ( Ok ( ( ) ) )
186186 }
187187 }
188188
189189 impl < T > Sink < T > for alloc:: collections:: VecDeque < T > {
190- type SinkError = Never ;
190+ type Error = Never ;
191191
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 > > {
193193 Poll :: Ready ( Ok ( ( ) ) )
194194 }
195195
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 > {
197197 // TODO: impl<T> Unpin for Vec<T> {}
198198 unsafe { self . get_unchecked_mut ( ) } . push_back ( item) ;
199199 Ok ( ( ) )
200200 }
201201
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 > > {
203203 Poll :: Ready ( Ok ( ( ) ) )
204204 }
205205
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 > > {
207207 Poll :: Ready ( Ok ( ( ) ) )
208208 }
209209 }
210210
211211 impl < S : ?Sized + Sink < Item > + Unpin , Item > Sink < Item > for alloc:: boxed:: Box < S > {
212- type SinkError = S :: SinkError ;
212+ type Error = S :: Error ;
213213
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 > > {
215215 Pin :: new ( & mut * * self ) . poll_ready ( cx)
216216 }
217217
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 > {
219219 Pin :: new ( & mut * * self ) . start_send ( item)
220220 }
221221
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 > > {
223223 Pin :: new ( & mut * * self ) . poll_flush ( cx)
224224 }
225225
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 > > {
227227 Pin :: new ( & mut * * self ) . poll_close ( cx)
228228 }
229229 }
0 commit comments