Skip to content

Commit 0484f2b

Browse files
committed
Rebase against master for futures upgrade
1 parent 533830b commit 0484f2b

File tree

6 files changed

+35
-65
lines changed

6 files changed

+35
-65
lines changed

tokio-codec/src/framed.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,21 @@ where
168168
U: Encoder<Item = I> + Unpin,
169169
U::Error: From<io::Error>,
170170
{
171-
type SinkError = U::Error;
171+
type Error = U::Error;
172172

173-
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
173+
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
174174
Pin::new(Pin::get_mut(self).inner.get_mut()).poll_ready(cx)
175175
}
176176

177-
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::SinkError> {
177+
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error> {
178178
Pin::new(Pin::get_mut(self).inner.get_mut()).start_send(item)
179179
}
180180

181-
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
181+
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
182182
Pin::new(Pin::get_mut(self).inner.get_mut()).poll_flush(cx)
183183
}
184184

185-
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
185+
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
186186
Pin::new(Pin::get_mut(self).inner.get_mut()).poll_close(cx)
187187
}
188188
}

tokio-codec/src/framed_read.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,21 @@ where
9898
T: Sink<I> + Unpin,
9999
D: Unpin,
100100
{
101-
type SinkError = T::SinkError;
101+
type Error = T::Error;
102102

103-
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
103+
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
104104
pin!(Pin::get_mut(self).inner.inner.0).poll_ready(cx)
105105
}
106106

107-
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::SinkError> {
107+
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error> {
108108
pin!(Pin::get_mut(self).inner.inner.0).start_send(item)
109109
}
110110

111-
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
111+
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
112112
pin!(Pin::get_mut(self).inner.inner.0).poll_flush(cx)
113113
}
114114

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
pin!(Pin::get_mut(self).inner.inner.0).poll_close(cx)
117117
}
118118
}

tokio-codec/src/framed_write.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ where
8888
E: Encoder<Item = I> + Unpin,
8989
E::Error: From<io::Error>,
9090
{
91-
type SinkError = E::Error;
91+
type Error = E::Error;
9292

93-
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
93+
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
9494
pin!(Pin::get_mut(self).inner).poll_ready(cx)
9595
}
9696

97-
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::SinkError> {
97+
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error> {
9898
pin!(Pin::get_mut(self).inner).start_send(item)
9999
}
100100

101-
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
101+
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
102102
pin!(Pin::get_mut(self).inner).poll_flush(cx)
103103
}
104104

105-
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
105+
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
106106
pin!(Pin::get_mut(self).inner).poll_close(cx)
107107
}
108108
}
@@ -175,12 +175,9 @@ impl<I, T> Sink<I> for FramedWrite2<T>
175175
where
176176
T: AsyncWrite + Encoder<Item = I> + Unpin,
177177
{
178-
type SinkError = T::Error;
178+
type Error = T::Error;
179179

180-
fn poll_ready(
181-
mut self: Pin<&mut Self>,
182-
cx: &mut Context<'_>,
183-
) -> Poll<Result<(), Self::SinkError>> {
180+
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
184181
// If the buffer is already over 8KiB, then attempt to flush it. If after flushing it's
185182
// *still* over 8KiB, then apply backpressure (reject the send).
186183
if self.buffer.len() >= BACKPRESSURE_BOUNDARY {
@@ -197,13 +194,13 @@ where
197194
Poll::Ready(Ok(()))
198195
}
199196

200-
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::SinkError> {
197+
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error> {
201198
let pinned = Pin::get_mut(self);
202199
pinned.inner.encode(item, &mut pinned.buffer)?;
203200
Ok(())
204201
}
205202

206-
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
203+
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
207204
trace!("flushing framed transport");
208205
let pinned = Pin::get_mut(self);
209206

@@ -233,10 +230,7 @@ where
233230
Poll::Ready(Ok(()))
234231
}
235232

236-
fn poll_close(
237-
mut self: Pin<&mut Self>,
238-
cx: &mut Context<'_>,
239-
) -> Poll<Result<(), Self::SinkError>> {
233+
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
240234
let () = try_ready!(pin!(self).poll_flush(cx));
241235
let () = try_ready!(pin!(self.inner).poll_shutdown(cx));
242236
Poll::Ready(Ok(()))

tokio-sync/src/mpsc/bounded.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,30 +215,24 @@ impl<T> Sender<T> {
215215

216216
#[cfg(feature = "async-traits")]
217217
impl<T> tokio_futures::Sink<T> for Sender<T> {
218-
type SinkError = SendError;
218+
type Error = SendError;
219219

220-
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
220+
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
221221
Sender::poll_ready(self.get_mut(), cx)
222222
}
223223

224-
fn start_send(mut self: Pin<&mut Self>, msg: T) -> Result<(), Self::SinkError> {
224+
fn start_send(mut self: Pin<&mut Self>, msg: T) -> Result<(), Self::Error> {
225225
self.as_mut().try_send(msg).map_err(|err| {
226226
assert!(err.is_full(), "call `poll_ready` before sending");
227227
SendError(())
228228
})
229229
}
230230

231-
fn poll_flush(
232-
self: Pin<&mut Self>,
233-
_cx: &mut Context<'_>,
234-
) -> Poll<Result<(), Self::SinkError>> {
231+
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
235232
Poll::Ready(Ok(()))
236233
}
237234

238-
fn poll_close(
239-
self: Pin<&mut Self>,
240-
_cx: &mut Context<'_>,
241-
) -> Poll<Result<(), Self::SinkError>> {
235+
fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
242236
Poll::Ready(Ok(()))
243237
}
244238
}

tokio-sync/src/mpsc/unbounded.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,30 +131,21 @@ impl<T> UnboundedSender<T> {
131131

132132
#[cfg(feature = "async-traits")]
133133
impl<T> tokio_futures::Sink<T> for UnboundedSender<T> {
134-
type SinkError = UnboundedSendError;
134+
type Error = UnboundedSendError;
135135

136-
fn poll_ready(
137-
self: Pin<&mut Self>,
138-
_cx: &mut Context<'_>,
139-
) -> Poll<Result<(), Self::SinkError>> {
136+
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
140137
Poll::Ready(Ok(()))
141138
}
142139

143-
fn start_send(mut self: Pin<&mut Self>, msg: T) -> Result<(), Self::SinkError> {
140+
fn start_send(mut self: Pin<&mut Self>, msg: T) -> Result<(), Self::Error> {
144141
self.try_send(msg).map_err(|_| UnboundedSendError(()))
145142
}
146143

147-
fn poll_flush(
148-
self: Pin<&mut Self>,
149-
_cx: &mut Context<'_>,
150-
) -> Poll<Result<(), Self::SinkError>> {
144+
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
151145
Poll::Ready(Ok(()))
152146
}
153147

154-
fn poll_close(
155-
self: Pin<&mut Self>,
156-
_cx: &mut Context<'_>,
157-
) -> Poll<Result<(), Self::SinkError>> {
148+
fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
158149
Poll::Ready(Ok(()))
159150
}
160151
}

tokio-sync/src/watch.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -368,31 +368,22 @@ impl<T> Sender<T> {
368368

369369
#[cfg(feature = "async-traits")]
370370
impl<T> tokio_futures::Sink<T> for Sender<T> {
371-
type SinkError = error::SendError<T>;
371+
type Error = error::SendError<T>;
372372

373-
fn poll_ready(
374-
self: Pin<&mut Self>,
375-
_cx: &mut Context<'_>,
376-
) -> Poll<Result<(), Self::SinkError>> {
373+
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
377374
Ready(Ok(()))
378375
}
379376

380-
fn start_send(self: Pin<&mut Self>, item: T) -> Result<(), Self::SinkError> {
377+
fn start_send(self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
381378
let _ = self.as_ref().get_ref().broadcast(item)?;
382379
Ok(())
383380
}
384381

385-
fn poll_flush(
386-
self: Pin<&mut Self>,
387-
_cx: &mut Context<'_>,
388-
) -> Poll<Result<(), Self::SinkError>> {
382+
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
389383
Ready(Ok(()))
390384
}
391385

392-
fn poll_close(
393-
self: Pin<&mut Self>,
394-
_cx: &mut Context<'_>,
395-
) -> Poll<Result<(), Self::SinkError>> {
386+
fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
396387
Ready(Ok(()))
397388
}
398389
}

0 commit comments

Comments
 (0)