Lines Matching full:either
13 /// use futures::future::Either;
19 /// Either::Left(async move { 12 })
21 /// Either::Right(async move { 44 })
28 pub enum Either<A, B> { enum
35 impl<A, B> Either<A, B> { implementation
36 /// Convert `Pin<&Either<A, B>>` to `Either<Pin<&A>, Pin<&B>>`,
38 pub fn as_pin_ref(self: Pin<&Self>) -> Either<Pin<&A>, Pin<&B>> { in as_pin_ref()
43 Either::Left(ref inner) => Either::Left(Pin::new_unchecked(inner)), in as_pin_ref()
44 Either::Right(ref inner) => Either::Right(Pin::new_unchecked(inner)), in as_pin_ref()
49 /// Convert `Pin<&mut Either<A, B>>` to `Either<Pin<&mut A>, Pin<&mut B>>`,
51 pub fn as_pin_mut(self: Pin<&mut Self>) -> Either<Pin<&mut A>, Pin<&mut B>> { in as_pin_mut()
59 Either::Left(ref mut inner) => Either::Left(Pin::new_unchecked(inner)), in as_pin_mut()
60 Either::Right(ref mut inner) => Either::Right(Pin::new_unchecked(inner)), in as_pin_mut()
66 impl<A, B, T> Either<(T, A), (T, B)> { impl
67 /// Factor out a homogeneous type from an either of pairs.
70 pub fn factor_first(self) -> (T, Either<A, B>) { in factor_first()
72 Either::Left((x, a)) => (x, Either::Left(a)), in factor_first()
73 Either::Right((x, b)) => (x, Either::Right(b)), in factor_first()
78 impl<A, B, T> Either<(A, T), (B, T)> { impl
79 /// Factor out a homogeneous type from an either of pairs.
82 pub fn factor_second(self) -> (Either<A, B>, T) { in factor_second()
84 Either::Left((a, x)) => (Either::Left(a), x), in factor_second()
85 Either::Right((b, x)) => (Either::Right(b), x), in factor_second()
90 impl<T> Either<T, T> { implementation
91 /// Extract the value of an either over two equivalent types.
94 Either::Left(x) => x, in into_inner()
95 Either::Right(x) => x, in into_inner()
100 impl<A, B> Future for Either<A, B> implementation
109 Either::Left(x) => x.poll(cx), in poll()
110 Either::Right(x) => x.poll(cx), in poll()
115 impl<A, B> FusedFuture for Either<A, B> implementation
122 Either::Left(x) => x.is_terminated(), in is_terminated()
123 Either::Right(x) => x.is_terminated(), in is_terminated()
128 impl<A, B> Stream for Either<A, B> implementation
137 Either::Left(x) => x.poll_next(cx), in poll_next()
138 Either::Right(x) => x.poll_next(cx), in poll_next()
144 Either::Left(x) => x.size_hint(), in size_hint()
145 Either::Right(x) => x.size_hint(), in size_hint()
150 impl<A, B> FusedStream for Either<A, B> implementation
157 Either::Left(x) => x.is_terminated(), in is_terminated()
158 Either::Right(x) => x.is_terminated(), in is_terminated()
164 impl<A, B, Item> Sink<Item> for Either<A, B> implementation
173 Either::Left(x) => x.poll_ready(cx), in poll_ready()
174 Either::Right(x) => x.poll_ready(cx), in poll_ready()
180 Either::Left(x) => x.start_send(item), in start_send()
181 Either::Right(x) => x.start_send(item), in start_send()
187 Either::Left(x) => x.poll_flush(cx), in poll_flush()
188 Either::Right(x) => x.poll_flush(cx), in poll_flush()
194 Either::Left(x) => x.poll_close(cx), in poll_close()
195 Either::Right(x) => x.poll_close(cx), in poll_close()
211 impl<A, B> AsyncRead for Either<A, B> implementation
222 Either::Left(x) => x.poll_read(cx, buf), in poll_read()
223 Either::Right(x) => x.poll_read(cx, buf), in poll_read()
233 Either::Left(x) => x.poll_read_vectored(cx, bufs), in poll_read_vectored()
234 Either::Right(x) => x.poll_read_vectored(cx, bufs), in poll_read_vectored()
239 impl<A, B> AsyncWrite for Either<A, B> implementation
250 Either::Left(x) => x.poll_write(cx, buf), in poll_write()
251 Either::Right(x) => x.poll_write(cx, buf), in poll_write()
261 Either::Left(x) => x.poll_write_vectored(cx, bufs), in poll_write_vectored()
262 Either::Right(x) => x.poll_write_vectored(cx, bufs), in poll_write_vectored()
268 Either::Left(x) => x.poll_flush(cx), in poll_flush()
269 Either::Right(x) => x.poll_flush(cx), in poll_flush()
275 Either::Left(x) => x.poll_close(cx), in poll_close()
276 Either::Right(x) => x.poll_close(cx), in poll_close()
281 impl<A, B> AsyncSeek for Either<A, B> implementation
292 Either::Left(x) => x.poll_seek(cx, pos), in poll_seek()
293 Either::Right(x) => x.poll_seek(cx, pos), in poll_seek()
298 impl<A, B> AsyncBufRead for Either<A, B> implementation
305 Either::Left(x) => x.poll_fill_buf(cx), in poll_fill_buf()
306 Either::Right(x) => x.poll_fill_buf(cx), in poll_fill_buf()
312 Either::Left(x) => x.consume(amt), in consume()
313 Either::Right(x) => x.consume(amt), in consume()