mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
Set Future types as must_use
This commit is contained in:
parent
01198532c1
commit
b4fa47bd09
@ -8,6 +8,7 @@ use futures::{Future, Poll};
|
||||
/// bytes copied or an error if one happens.
|
||||
///
|
||||
/// [`copy`]: fn.copy.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct Copy<R, W> {
|
||||
reader: R,
|
||||
read_done: bool,
|
||||
|
@ -9,6 +9,7 @@ use futures::{Poll, Future, Async};
|
||||
/// Created by the [`flush`] function.
|
||||
///
|
||||
/// [`flush`]: fn.flush.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct Flush<A> {
|
||||
a: Option<A>,
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ pub fn read<R, T>(rd: R, buf: T) -> Read<R, T>
|
||||
/// a buffer.
|
||||
///
|
||||
/// Created by the [`read`] function.
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct Read<R, T> {
|
||||
state: State<R, T>,
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use futures::{Poll, Future};
|
||||
/// Created by the [`read_exact`] function.
|
||||
///
|
||||
/// [`read_exact`]: fn.read_exact.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct ReadExact<A, T> {
|
||||
state: State<A, T>,
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use futures::{Poll, Future};
|
||||
/// Created by the [`read_to_end`] function.
|
||||
///
|
||||
/// [`read_to_end`]: fn.read_to_end.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct ReadToEnd<A> {
|
||||
state: State<A>,
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use futures::{Poll, Future};
|
||||
/// Created by the [`read_until`] function.
|
||||
///
|
||||
/// [`read_until`]: fn.read_until.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct ReadUntil<A> {
|
||||
state: State<A>,
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ use futures::{Poll, Future};
|
||||
/// This is created by the [`write_all`] top-level method.
|
||||
///
|
||||
/// [`write_all`]: fn.write_all.html
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct WriteAll<A, T> {
|
||||
state: State<A, T>,
|
||||
}
|
||||
|
@ -235,10 +235,12 @@ pub struct TcpStream {
|
||||
|
||||
/// Future returned by `TcpStream::connect` which will resolve to a `TcpStream`
|
||||
/// when the stream is connected.
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct TcpStreamNew {
|
||||
inner: TcpStreamNewState,
|
||||
}
|
||||
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
enum TcpStreamNewState {
|
||||
Waiting(TcpStream),
|
||||
Error(io::Error),
|
||||
|
@ -394,6 +394,7 @@ impl fmt::Debug for UdpSocket {
|
||||
/// A future used to write the entire contents of some data to a UDP socket.
|
||||
///
|
||||
/// This is created by the `UdpSocket::send_dgram` method.
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct SendDgram<T> {
|
||||
state: SendState<T>,
|
||||
}
|
||||
@ -441,6 +442,7 @@ impl<T> Future for SendDgram<T>
|
||||
/// A future used to receive a datagram from a UDP socket.
|
||||
///
|
||||
/// This is created by the `UdpSocket::recv_dgram` method.
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
pub struct RecvDgram<T> {
|
||||
state: RecvState<T>,
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ use reactor::timeout_token::TimeoutToken;
|
||||
/// Note that timeouts are not intended for high resolution timers, but rather
|
||||
/// they will likely fire some granularity after the exact instant that they're
|
||||
/// otherwise indicated to fire at.
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
#[derive(Debug)]
|
||||
pub struct Timeout {
|
||||
token: TimeoutToken,
|
||||
|
Loading…
x
Reference in New Issue
Block a user