pub struct UnboundedChannelSubscription<M> { /* private fields */ }Expand description
A subscription that receives messages from an unbounded channel.
This is the unbounded counterpart of ChannelSubscription. Use this
when the sender should never block, at the cost of unbounded memory
growth if messages are produced faster than consumed.
§Example
use envision::app::UnboundedChannelSubscription;
let (tx, rx) = tokio::sync::mpsc::unbounded_channel::<String>();
let subscription = UnboundedChannelSubscription::new(rx);Implementations§
Source§impl<M> UnboundedChannelSubscription<M>
impl<M> UnboundedChannelSubscription<M>
Sourcepub fn new(receiver: UnboundedReceiver<M>) -> Self
pub fn new(receiver: UnboundedReceiver<M>) -> Self
Creates a subscription from an unbounded channel receiver.
Trait Implementations§
Source§impl<M: Send + 'static> Subscription<M> for UnboundedChannelSubscription<M>
impl<M: Send + 'static> Subscription<M> for UnboundedChannelSubscription<M>
Source§fn into_stream(
self: Box<Self>,
cancel: CancellationToken,
) -> Pin<Box<dyn Stream<Item = M> + Send>>
fn into_stream( self: Box<Self>, cancel: CancellationToken, ) -> Pin<Box<dyn Stream<Item = M> + Send>>
Converts this subscription into a stream of messages. Read more
Auto Trait Implementations§
impl<M> Freeze for UnboundedChannelSubscription<M>
impl<M> RefUnwindSafe for UnboundedChannelSubscription<M>
impl<M> Send for UnboundedChannelSubscription<M>where
M: Send,
impl<M> Sync for UnboundedChannelSubscription<M>where
M: Send,
impl<M> Unpin for UnboundedChannelSubscription<M>
impl<M> UnsafeUnpin for UnboundedChannelSubscription<M>
impl<M> UnwindSafe for UnboundedChannelSubscription<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<M, S> SubscriptionExt<M> for Swhere
S: Subscription<M>,
impl<M, S> SubscriptionExt<M> for Swhere
S: Subscription<M>,
Source§fn map<N, F>(self, f: F) -> MappedSubscription<M, N, F, Self>
fn map<N, F>(self, f: F) -> MappedSubscription<M, N, F, Self>
Maps the messages of this subscription. Read more
Source§fn filter<P>(self, predicate: P) -> FilterSubscription<M, Self, P>
fn filter<P>(self, predicate: P) -> FilterSubscription<M, Self, P>
Filters messages from this subscription. Read more
Source§fn take(self, count: usize) -> TakeSubscription<M, Self>
fn take(self, count: usize) -> TakeSubscription<M, Self>
Takes only the first N messages from this subscription. Read more