[−][src]Trait postage::Stream
An asynchronous stream, which produces a series of messages until closed.
Associated Types
Loading content...Required methods
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
Attempts to retrieve an item from the stream, without blocking.
Returns PollRecv::Ready(value)
if a message is ready
Returns PollRecv::Pending
if the stream is open, but no message is currently available.
Returns PollRecv::Closed
if the stream is closed, and no messages are expected.
Provided methods
pub fn recv(&mut self) -> RecvFuture<'_, Self>ⓘNotable traits for RecvFuture<'s, S>
impl<'s, S: ?Sized> Future for RecvFuture<'s, S> where
S: Stream + Unpin, type Output = Option<S::Item>;
where
Self: Unpin,
[src]
Notable traits for RecvFuture<'s, S>
impl<'s, S: ?Sized> Future for RecvFuture<'s, S> where
S: Stream + Unpin, type Output = Option<S::Item>;
Self: Unpin,
Retrieves a message from the stream.
Resolves to Some(value)
if the stream is open
Resolves to None
if the stream is closed, and no further messages are expected.
pub fn try_recv(&mut self) -> Result<Self::Item, TryRecvError> where
Self: Unpin,
[src]
Self: Unpin,
Attempts to retrive a message from the stream, without blocking.
Returns Ok(value)
if a message was ready.
Returns TryRecvError::Pending
if the stream was open, but no messages were available.
Returns TryRecvError::Rejected
if the stream has been closed.
pub fn once(item: Self::Item) -> OnceStream<Self::Item>
[src]
Returns a stream which produces a single value, and then is closed.
pub fn repeat(item: Self::Item) -> RepeatStream<Self::Item> where
Self::Item: Clone,
[src]
Self::Item: Clone,
Returns a stream which infiniately produces a clonable value.
pub fn map<Map, Into>(self, map: Map) -> MapStream<Self, Map, Into> where
Map: Fn(Self::Item) -> Into,
Self: Sized,
[src]
Map: Fn(Self::Item) -> Into,
Self: Sized,
Transforms the stream with a map function.
pub fn filter<Filter>(self, filter: Filter) -> FilterStream<Self, Filter> where
Self: Sized + Unpin,
Filter: FnMut(&Self::Item) -> bool + Unpin,
[src]
Self: Sized + Unpin,
Filter: FnMut(&Self::Item) -> bool + Unpin,
Filters messages returned by the stream, forwarding any to .recv().await
where filter returns true.
pub fn merge<Other>(self, other: Other) -> MergeStream<Self, Other> where
Other: Stream<Item = Self::Item>,
Self: Sized,
[src]
Other: Stream<Item = Self::Item>,
Self: Sized,
Merges two streams, returning values from both at once, until both are closed.
pub fn chain<Other>(self, other: Other) -> ChainStream<Self, Other> where
Other: Stream<Item = Self::Item>,
Self: Sized,
[src]
Other: Stream<Item = Self::Item>,
Self: Sized,
Chains two streams, returning values from this until it is closed, and then returning values from other.
pub fn find<Condition>(
self,
condition: Condition
) -> FindStream<Self, Condition> where
Self: Sized + Unpin,
Condition: Fn(&Self::Item) -> bool + Unpin,
[src]
self,
condition: Condition
) -> FindStream<Self, Condition> where
Self: Sized + Unpin,
Condition: Fn(&Self::Item) -> bool + Unpin,
Finds a message matching a condition. When the condition is matched, a single value will be returned.
pub fn log(self, level: Level) -> StreamLog<Self> where
Self: Sized,
Self::Item: Debug,
[src]
Self: Sized,
Self::Item: Debug,
Logs messages that are produced by the stream using the Debug trait, at the provided log level.
Requires the logging
feature
Implementations on Foreign Types
impl<S: ?Sized> Stream for &mut S where
S: Stream + Unpin,
[src]
S: Stream + Unpin,
type Item = S::Item
pub fn poll_recv(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
mut self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
impl<P, S: ?Sized> Stream for Pin<P> where
P: DerefMut<Target = S> + Unpin,
S: Stream + Unpin,
[src]
P: DerefMut<Target = S> + Unpin,
S: Stream + Unpin,
type Item = <S as Stream>::Item
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
Implementors
impl Stream for postage::barrier::Receiver
[src]
type Item = ()
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
impl<T> Stream for postage::broadcast::Receiver<T> where
T: Clone,
[src]
T: Clone,
type Item = T
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
impl<T> Stream for postage::mpsc::Receiver<T>
[src]
type Item = T
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
impl<T> Stream for postage::oneshot::Receiver<T>
[src]
type Item = T
pub fn poll_recv(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> PollRecv<Self::Item>
impl<T> Stream for postage::watch::Receiver<T> where
T: Clone,
[src]
T: Clone,