Set Stream types as must_use

This commit is contained in:
Taylor Cramer 2017-10-25 18:02:14 -07:00
parent b4fa47bd09
commit bd9a07f3ad
4 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,7 @@ pub struct Sender<T> {
/// `Stream` trait to represent received messages. /// `Stream` trait to represent received messages.
/// ///
/// [`channel`]: fn.channel.html /// [`channel`]: fn.channel.html
#[must_use = "streams do nothing unless polled"]
pub struct Receiver<T> { pub struct Receiver<T> {
rx: PollEvented<channel::Receiver<T>>, rx: PollEvented<channel::Receiver<T>>,
} }

View File

@ -310,6 +310,7 @@ pub trait Codec {
/// the `Codec` trait to encode and decode frames. /// the `Codec` trait to encode and decode frames.
/// ///
/// You can acquire a `Framed` instance by using the `Io::framed` adapter. /// You can acquire a `Framed` instance by using the `Io::framed` adapter.
#[must_use = "streams do nothing unless polled"]
pub struct Framed<T, C> { pub struct Framed<T, C> {
upstream: T, upstream: T,
codec: C, codec: C,

View File

@ -25,6 +25,7 @@ pub struct TcpListener {
/// Stream returned by the `TcpListener::incoming` function representing the /// Stream returned by the `TcpListener::incoming` function representing the
/// stream of sockets received from a listener. /// stream of sockets received from a listener.
#[must_use = "streams do nothing unless polled"]
pub struct Incoming { pub struct Incoming {
inner: TcpListener, inner: TcpListener,
} }

View File

@ -21,6 +21,7 @@ use reactor::timeout_token::TimeoutToken;
/// Note that timeouts are not intended for high resolution timers, but rather /// 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 /// they will likely fire some granularity after the exact instant that they're
/// otherwise indicated to fire at. /// otherwise indicated to fire at.
#[must_use = "streams do nothing unless polled"]
pub struct Interval { pub struct Interval {
token: TimeoutToken, token: TimeoutToken,
next: Instant, next: Instant,