pub struct BoxedSubscriptionSend(/* private fields */);Expand description
A boxed subscription for shared (multi-threaded) contexts.
This allows storing heterogeneous subscriptions in collections across thread boundaries.
§Why 'static?
Similar to BoxedSubscription, shared subscriptions must be 'static
to be truly independent control handles. In multi-threaded contexts, this is
even more critical as valid lifetimes across threads are typically 'static
(required for Send in many cases, though scoped threads exist, rxRust
targets general async/sync usage).
§Examples
use rxrust::prelude::*;
// Create a thread-safe boxed subscription
let sub = BoxedSubscriptionSend::new(());Implementations§
Source§impl BoxedSubscriptionSend
impl BoxedSubscriptionSend
Sourcepub fn new(subscription: impl Subscription + Send + 'static) -> Self
pub fn new(subscription: impl Subscription + Send + 'static) -> Self
Create a new thread-safe boxed subscription from any Send subscription type.
Trait Implementations§
Source§impl Subscription for BoxedSubscriptionSend
impl Subscription for BoxedSubscriptionSend
Source§fn unsubscribe(self)
fn unsubscribe(self)
Cancel the subscription (terminal operation, consumes self)
Source§fn unsubscribe_when_dropped(self) -> SubscriptionGuard<Self>where
Self: Sized,
fn unsubscribe_when_dropped(self) -> SubscriptionGuard<Self>where
Self: Sized,
Activates “RAII” behavior for this subscription. That means
unsubscribe() will be called automatically as soon as the returned
value goes out of scope. Read moreAuto Trait Implementations§
impl Freeze for BoxedSubscriptionSend
impl !RefUnwindSafe for BoxedSubscriptionSend
impl Send for BoxedSubscriptionSend
impl !Sync for BoxedSubscriptionSend
impl Unpin for BoxedSubscriptionSend
impl !UnwindSafe for BoxedSubscriptionSend
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> BoxedSubscriptionInner for Twhere
T: Subscription,
impl<T> BoxedSubscriptionInner for Twhere
T: Subscription,
fn boxed_unsubscribe(self: Box<T>)
fn boxed_is_closed(&self) -> bool
Source§impl<T> IntoBoxedSubscription<BoxedSubscription> for Twhere
T: Subscription + 'static,
impl<T> IntoBoxedSubscription<BoxedSubscription> for Twhere
T: Subscription + 'static,
Source§fn into_boxed(self) -> BoxedSubscription
fn into_boxed(self) -> BoxedSubscription
Convert this subscription into a boxed subscription.
Source§impl<T> IntoBoxedSubscription<BoxedSubscriptionSend> for Twhere
T: Subscription + Send + 'static,
impl<T> IntoBoxedSubscription<BoxedSubscriptionSend> for Twhere
T: Subscription + Send + 'static,
Source§fn into_boxed(self) -> BoxedSubscriptionSend
fn into_boxed(self) -> BoxedSubscriptionSend
Convert this subscription into a boxed subscription.