From bd9a07f3ad7cd16fba3c4dd8258a991a88c7f82d Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Wed, 25 Oct 2017 18:02:14 -0700 Subject: [PATCH] Set Stream types as must_use --- src/channel.rs | 1 + src/io/frame.rs | 1 + src/net/tcp.rs | 1 + src/reactor/interval.rs | 1 + 4 files changed, 4 insertions(+) diff --git a/src/channel.rs b/src/channel.rs index 6251afb49..85060e52b 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -37,6 +37,7 @@ pub struct Sender { /// `Stream` trait to represent received messages. /// /// [`channel`]: fn.channel.html +#[must_use = "streams do nothing unless polled"] pub struct Receiver { rx: PollEvented>, } diff --git a/src/io/frame.rs b/src/io/frame.rs index 821dc3cfb..151648ac2 100644 --- a/src/io/frame.rs +++ b/src/io/frame.rs @@ -310,6 +310,7 @@ pub trait Codec { /// the `Codec` trait to encode and decode frames. /// /// You can acquire a `Framed` instance by using the `Io::framed` adapter. +#[must_use = "streams do nothing unless polled"] pub struct Framed { upstream: T, codec: C, diff --git a/src/net/tcp.rs b/src/net/tcp.rs index e1a680389..7cd7a1458 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -25,6 +25,7 @@ pub struct TcpListener { /// Stream returned by the `TcpListener::incoming` function representing the /// stream of sockets received from a listener. +#[must_use = "streams do nothing unless polled"] pub struct Incoming { inner: TcpListener, } diff --git a/src/reactor/interval.rs b/src/reactor/interval.rs index 647ea45bf..429be6c82 100644 --- a/src/reactor/interval.rs +++ b/src/reactor/interval.rs @@ -21,6 +21,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 = "streams do nothing unless polled"] pub struct Interval { token: TimeoutToken, next: Instant,