mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 18:11:22 +00:00
add must_use for Future (#450)
This commit is contained in:
committed by
Toralf Wittner
parent
02576eecf1
commit
ee9be6f0c9
@ -562,6 +562,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of `Future` that yields the next incoming substream from a dialed connection.
|
/// Implementation of `Future` that yields the next incoming substream from a dialed connection.
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct ConnectionReuseIncoming<T, D, M>
|
pub struct ConnectionReuseIncoming<T, D, M>
|
||||||
where
|
where
|
||||||
T: Transport,
|
T: Transport,
|
||||||
|
@ -213,6 +213,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub enum EitherOutbound<A: StreamMuxer, B: StreamMuxer> {
|
pub enum EitherOutbound<A: StreamMuxer, B: StreamMuxer> {
|
||||||
A(A::OutboundSubstream),
|
A(A::OutboundSubstream),
|
||||||
B(B::OutboundSubstream),
|
B(B::OutboundSubstream),
|
||||||
@ -220,6 +221,7 @@ pub enum EitherOutbound<A: StreamMuxer, B: StreamMuxer> {
|
|||||||
|
|
||||||
/// Implements `Stream` and dispatches all method calls to either `First` or `Second`.
|
/// Implements `Stream` and dispatches all method calls to either `First` or `Second`.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub enum EitherListenStream<A, B> {
|
pub enum EitherListenStream<A, B> {
|
||||||
First(A),
|
First(A),
|
||||||
Second(B),
|
Second(B),
|
||||||
@ -248,6 +250,7 @@ where
|
|||||||
// If Rust had impl Trait we could use the Either enum from the futures crate and add some
|
// If Rust had impl Trait we could use the Either enum from the futures crate and add some
|
||||||
// modifiers to it. This custom enum is a combination of Either and these modifiers.
|
// modifiers to it. This custom enum is a combination of Either and these modifiers.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub enum EitherListenUpgrade<A, B> {
|
pub enum EitherListenUpgrade<A, B> {
|
||||||
First(A),
|
First(A),
|
||||||
Second(B),
|
Second(B),
|
||||||
|
@ -222,6 +222,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future that must be driven to completion in order for the swarm to work.
|
/// Future that must be driven to completion in order for the swarm to work.
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct SwarmFuture<T, H>
|
pub struct SwarmFuture<T, H>
|
||||||
where
|
where
|
||||||
T: MuxedTransport + 'static, // TODO: 'static :-/
|
T: MuxedTransport + 'static, // TODO: 'static :-/
|
||||||
|
@ -96,6 +96,7 @@ pub struct Interrupt {
|
|||||||
_tx: oneshot::Sender<()>,
|
_tx: oneshot::Sender<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct InterruptibleDial<F> {
|
pub struct InterruptibleDial<F> {
|
||||||
inner: F,
|
inner: F,
|
||||||
rx: future::Shared<oneshot::Receiver<()>>,
|
rx: future::Shared<oneshot::Receiver<()>>,
|
||||||
|
@ -342,6 +342,7 @@ impl<T> Drop for UniqueConnec<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by `UniqueConnec::dial()`.
|
/// Future returned by `UniqueConnec::dial()`.
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct UniqueConnecFuture<T> {
|
pub struct UniqueConnecFuture<T> {
|
||||||
inner: Weak<Mutex<UniqueConnecInner<T>>>,
|
inner: Weak<Mutex<UniqueConnecInner<T>>>,
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ pub enum EitherUpgradeIdentifier<A, B> {
|
|||||||
// If Rust had impl Trait we could use the Either enum from the futures crate and add some
|
// If Rust had impl Trait we could use the Either enum from the futures crate and add some
|
||||||
// modifiers to it. This custom enum is a combination of Either and these modifiers.
|
// modifiers to it. This custom enum is a combination of Either and these modifiers.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub enum EitherConnUpgrFuture<A, B> {
|
pub enum EitherConnUpgrFuture<A, B> {
|
||||||
First(A),
|
First(A),
|
||||||
Second(B),
|
Second(B),
|
||||||
|
@ -519,6 +519,7 @@ pub struct Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of `Future` that must be driven to completion in order for floodsub to work.
|
/// Implementation of `Future` that must be driven to completion in order for floodsub to work.
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct FloodSubFuture {
|
pub struct FloodSubFuture {
|
||||||
inner: Box<Future<Item = (), Error = IoError>>,
|
inner: Box<Future<Item = (), Error = IoError>>,
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ impl<T: Transport> Stream for Listener<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct ListenerUpgrade<T: Transport>(RateLimited<T::ListenerUpgrade>);
|
pub struct ListenerUpgrade<T: Transport>(RateLimited<T::ListenerUpgrade>);
|
||||||
|
|
||||||
impl<T> Future for ListenerUpgrade<T>
|
impl<T> Future for ListenerUpgrade<T>
|
||||||
|
@ -37,6 +37,7 @@ use tokio_io::{AsyncRead, AsyncWrite};
|
|||||||
///
|
///
|
||||||
/// [`copy`]: fn.copy.html
|
/// [`copy`]: fn.copy.html
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct Copy<R, W> {
|
pub struct Copy<R, W> {
|
||||||
reader: Option<R>,
|
reader: Option<R>,
|
||||||
read_done: bool,
|
read_done: bool,
|
||||||
|
@ -192,6 +192,7 @@ fn multiaddr_to_socketaddr(addr: &Multiaddr) -> Result<SocketAddr, ()> {
|
|||||||
|
|
||||||
/// Future that dials a TCP/IP address.
|
/// Future that dials a TCP/IP address.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct TcpDialFut {
|
pub struct TcpDialFut {
|
||||||
inner: ConnectFuture,
|
inner: ConnectFuture,
|
||||||
/// Address we're dialing. Extracted when the `Future` finishes.
|
/// Address we're dialing. Extracted when the `Future` finishes.
|
||||||
|
@ -180,6 +180,7 @@ where
|
|||||||
|
|
||||||
// TODO: can be removed and replaced with an `impl Future` once impl Trait is fully stable
|
// TODO: can be removed and replaced with an `impl Future` once impl Trait is fully stable
|
||||||
// in Rust (https://github.com/rust-lang/rust/issues/34511)
|
// in Rust (https://github.com/rust-lang/rust/issues/34511)
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct TimeoutIncoming<InnerFut> {
|
pub struct TimeoutIncoming<InnerFut> {
|
||||||
inner: InnerFut,
|
inner: InnerFut,
|
||||||
timeout: Duration,
|
timeout: Duration,
|
||||||
@ -204,6 +205,7 @@ where
|
|||||||
/// Wraps around a `Future`. Turns the error type from `TimeoutError<IoError>` to `IoError`.
|
/// Wraps around a `Future`. Turns the error type from `TimeoutError<IoError>` to `IoError`.
|
||||||
// TODO: can be replaced with `impl Future` once `impl Trait` are fully stable in Rust
|
// TODO: can be replaced with `impl Future` once `impl Trait` are fully stable in Rust
|
||||||
// (https://github.com/rust-lang/rust/issues/34511)
|
// (https://github.com/rust-lang/rust/issues/34511)
|
||||||
|
#[must_use = "futures do nothing unless polled"]
|
||||||
pub struct TokioTimerMapErr<InnerFut> {
|
pub struct TokioTimerMapErr<InnerFut> {
|
||||||
inner: InnerFut,
|
inner: InnerFut,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user