pub trait SubscriptionLike {
// Required methods
fn is_closed(&self) -> bool;
fn unsubscribe(&mut self);
}Expand description
A SubscriptionLike is something that can be “unsubscribed” from, which will close it, rendering it no longer operational. If it also owns resources, it will also release those resources, usually by executing Teardowns
Drop is mandatory to manually implement for [TeardownCollection], but not for subscribers that do not actually own a teardown, only forward the added teardowns downstream. This is why this bound is only enforced on the Observable::Subscription.
It has to be implemented to guarantee that resources are
properly released on drop. Note that some subscriptions do not need to
do anything on drop. If that’s the case, the drop fn should only contain
a comment on why it doesn’t need to do anything.
Required Methods§
Sourcefn is_closed(&self) -> bool
fn is_closed(&self) -> bool
Returns if the subscription is closed or not. A subscription can be closed by calling unsubscribe on it. Some special subscriptions made by observables that only ever emit values during subscribe, will produce subscriptions that are created closed.
Once closed, a subscription stays closed.
Sourcefn unsubscribe(&mut self)
fn unsubscribe(&mut self)
Releases all resources associated with this subscription, and marks it as closed.
Once closed, a subscription stays closed.
Implementations on Foreign Types§
Source§impl SubscriptionLike for InertSubscription
impl SubscriptionLike for InertSubscription
Source§impl<Destination> SubscriptionLike for Arc<Mutex<Destination>>where
Destination: SubscriptionLike + ?Sized,
impl<Destination> SubscriptionLike for Arc<Mutex<Destination>>where
Destination: SubscriptionLike + ?Sized,
Source§impl<Destination> SubscriptionLike for Arc<RwLock<Destination>>where
Destination: SubscriptionLike + ?Sized,
impl<Destination> SubscriptionLike for Arc<RwLock<Destination>>where
Destination: SubscriptionLike + ?Sized,
Source§impl<Destination> SubscriptionLike for Weak<Mutex<Destination>>where
Destination: SubscriptionLike + ?Sized,
impl<Destination> SubscriptionLike for Weak<Mutex<Destination>>where
Destination: SubscriptionLike + ?Sized,
Source§impl<Destination> SubscriptionLike for DematerializeSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for DematerializeSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for EndWithSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for EndWithSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for ErrorBoundarySubscriber<Destination>where
Destination: Subscriber<InError = Infallible>,
impl<Destination> SubscriptionLike for ErrorBoundarySubscriber<Destination>where
Destination: Subscriber<InError = Infallible>,
Source§impl<Destination> SubscriptionLike for IdentitySubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for IdentitySubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for LiftOptionSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for LiftOptionSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for MapNeverBothSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for MapNeverBothSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for MapNeverErrorSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for MapNeverErrorSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for MapNeverNextSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for MapNeverNextSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for SkipSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for SkipSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination> SubscriptionLike for TakeSubscriber<Destination>where
Destination: Subscriber,
impl<Destination> SubscriptionLike for TakeSubscriber<Destination>where
Destination: Subscriber,
Source§impl<Destination, Iterator, S> SubscriptionLike for OnTickIteratorSubscription<Destination, Iterator, S>where
Destination: 'static + Subscriber<In = <Iterator as IntoIterator>::Item, InError = Infallible>,
Iterator: IntoIterator,
<Iterator as IntoIterator>::Item: Signal,
S: Scheduler,
impl<Destination, Iterator, S> SubscriptionLike for OnTickIteratorSubscription<Destination, Iterator, S>where
Destination: 'static + Subscriber<In = <Iterator as IntoIterator>::Item, InError = Infallible>,
Iterator: IntoIterator,
<Iterator as IntoIterator>::Item: Signal,
S: Scheduler,
Source§impl<Destination, O1, O2> SubscriptionLike for CombineChangesSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (Change<<O1 as ObservableOutput>::Out>, Change<<O2 as ObservableOutput>::Out>)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
impl<Destination, O1, O2> SubscriptionLike for CombineChangesSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (Change<<O1 as ObservableOutput>::Out>, Change<<O2 as ObservableOutput>::Out>)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
Source§impl<Destination, O1, O2> SubscriptionLike for CombineLatestSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
impl<Destination, O1, O2> SubscriptionLike for CombineLatestSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
Source§impl<Destination, O1, O2> SubscriptionLike for JoinSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
impl<Destination, O1, O2> SubscriptionLike for JoinSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
Source§impl<Destination, O1, O2> SubscriptionLike for ZipSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
impl<Destination, O1, O2> SubscriptionLike for ZipSubscriber<Destination, O1, O2>where
Destination: Subscriber<In = (<O1 as ObservableOutput>::Out, <O2 as ObservableOutput>::Out)>,
O1: 'static + Observable,
<O1 as ObservableOutput>::Out: Clone,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: 'static + Observable,
<O2 as ObservableOutput>::Out: Clone,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
Source§impl<Destination, S> SubscriptionLike for IntervalSubscription<Destination, S>
impl<Destination, S> SubscriptionLike for IntervalSubscription<Destination, S>
Source§impl<Destination, S> SubscriptionLike for TimerSubscription<Destination, S>
impl<Destination, S> SubscriptionLike for TimerSubscription<Destination, S>
Source§impl<Destination, S> SubscriptionLike for DebounceTimeSubscriber<Destination, S>
impl<Destination, S> SubscriptionLike for DebounceTimeSubscriber<Destination, S>
Source§impl<Destination, S> SubscriptionLike for DelaySubscriber<Destination, S>
impl<Destination, S> SubscriptionLike for DelaySubscriber<Destination, S>
Source§impl<Destination, S> SubscriptionLike for ObserveOnSubscriber<Destination, S>
impl<Destination, S> SubscriptionLike for ObserveOnSubscriber<Destination, S>
Source§impl<Destination, S> SubscriptionLike for ThrottleTimeSubscriber<Destination, S>
impl<Destination, S> SubscriptionLike for ThrottleTimeSubscriber<Destination, S>
Source§impl<Filter, Destination> SubscriptionLike for FilterSubscriber<Filter, Destination>where
Filter: for<'a> Fn(&'a <Destination as ObserverInput>::In, usize) -> bool,
Destination: Subscriber,
impl<Filter, Destination> SubscriptionLike for FilterSubscriber<Filter, Destination>where
Filter: for<'a> Fn(&'a <Destination as ObserverInput>::In, usize) -> bool,
Destination: Subscriber,
Source§impl<In, Destination> SubscriptionLike for BufferCountSubscriber<In, Destination>
impl<In, Destination> SubscriptionLike for BufferCountSubscriber<In, Destination>
Source§impl<In, Destination> SubscriptionLike for EnumerateSubscriber<In, Destination>
impl<In, Destination> SubscriptionLike for EnumerateSubscriber<In, Destination>
Source§impl<In, Destination> SubscriptionLike for IsEmptySubscriber<In, Destination>
impl<In, Destination> SubscriptionLike for IsEmptySubscriber<In, Destination>
Source§impl<In, Destination> SubscriptionLike for PairwiseSubscriber<In, Destination>
impl<In, Destination> SubscriptionLike for PairwiseSubscriber<In, Destination>
Source§impl<In, InError> SubscriptionLike for MulticastSubscription<In, InError>
impl<In, InError> SubscriptionLike for MulticastSubscription<In, InError>
Source§impl<In, InError, Destination> SubscriptionLike for CountSubscriber<In, InError, Destination>
impl<In, InError, Destination> SubscriptionLike for CountSubscriber<In, InError, Destination>
Source§impl<In, InError, Destination> SubscriptionLike for ElementAtSubscriber<In, InError, Destination>where
In: Signal,
InError: Signal,
Destination: Subscriber<In = In, InError = ElementAtOperatorError<InError>>,
impl<In, InError, Destination> SubscriptionLike for ElementAtSubscriber<In, InError, Destination>where
In: Signal,
InError: Signal,
Destination: Subscriber<In = In, InError = ElementAtOperatorError<InError>>,
Source§impl<In, InError, Destination> SubscriptionLike for IntoResultSubscriber<In, InError, Destination>
impl<In, InError, Destination> SubscriptionLike for IntoResultSubscriber<In, InError, Destination>
Source§impl<In, InError, Destination> SubscriptionLike for MaterializeSubscriber<In, InError, Destination>where
In: Signal,
InError: Signal,
Destination: Subscriber<In = ObserverNotification<In, InError>, InError = Infallible>,
impl<In, InError, Destination> SubscriptionLike for MaterializeSubscriber<In, InError, Destination>where
In: Signal,
InError: Signal,
Destination: Subscriber<In = ObserverNotification<In, InError>, InError = Infallible>,
Source§impl<In, InError, ErrorMapper, OutError, Destination> SubscriptionLike for MapErrorSubscriber<In, InError, ErrorMapper, OutError, Destination>
impl<In, InError, ErrorMapper, OutError, Destination> SubscriptionLike for MapErrorSubscriber<In, InError, ErrorMapper, OutError, Destination>
Source§impl<In, InError, Fallback, Destination, S> SubscriptionLike for FallbackWhenSilentSubscriber<In, InError, Fallback, Destination, S>where
In: Signal,
InError: Signal,
Fallback: 'static + Fn(<S as WithWorkInputOutput>::Tick, &mut <<S as WithWorkContextProvider>::WorkContextProvider as WorkContextProvider>::Item<'_>, usize) -> In + Send + Sync,
Destination: Subscriber<In = In, InError = InError>,
S: Scheduler,
impl<In, InError, Fallback, Destination, S> SubscriptionLike for FallbackWhenSilentSubscriber<In, InError, Fallback, Destination, S>where
In: Signal,
InError: Signal,
Fallback: 'static + Fn(<S as WithWorkInputOutput>::Tick, &mut <<S as WithWorkContextProvider>::WorkContextProvider as WorkContextProvider>::Item<'_>, usize) -> In + Send + Sync,
Destination: Subscriber<In = In, InError = InError>,
S: Scheduler,
Source§impl<In, InError, HigherOrderSubscriber, ErrorMapper, Destination> SubscriptionLike for HigherOrderAllSubscriber<In, InError, HigherOrderSubscriber, ErrorMapper, Destination>where
In: Signal + Observable,
InError: Signal,
HigherOrderSubscriber: HigherOrderSubscriberProvider,
ErrorMapper: 'static + FnOnce(InError) -> <In as ObservableOutput>::OutError + Send + Sync,
Destination: 'static + Subscriber<In = <In as ObservableOutput>::Out, InError = <In as ObservableOutput>::OutError>,
impl<In, InError, HigherOrderSubscriber, ErrorMapper, Destination> SubscriptionLike for HigherOrderAllSubscriber<In, InError, HigherOrderSubscriber, ErrorMapper, Destination>where
In: Signal + Observable,
InError: Signal,
HigherOrderSubscriber: HigherOrderSubscriberProvider,
ErrorMapper: 'static + FnOnce(InError) -> <In as ObservableOutput>::OutError + Send + Sync,
Destination: 'static + Subscriber<In = <In as ObservableOutput>::Out, InError = <In as ObservableOutput>::OutError>,
Source§impl<In, InError, InnerObservable, ErrorMapper, Destination> SubscriptionLike for CatchSubscriber<In, InError, InnerObservable, ErrorMapper, Destination>where
In: Signal,
InError: Signal,
InnerObservable: Observable<Out = In> + Signal,
ErrorMapper: 'static + FnOnce(InError) -> InnerObservable + Send + Sync,
Destination: 'static + Subscriber<In = In, InError = <InnerObservable as ObservableOutput>::OutError>,
impl<In, InError, InnerObservable, ErrorMapper, Destination> SubscriptionLike for CatchSubscriber<In, InError, InnerObservable, ErrorMapper, Destination>where
In: Signal,
InError: Signal,
InnerObservable: Observable<Out = In> + Signal,
ErrorMapper: 'static + FnOnce(InError) -> InnerObservable + Send + Sync,
Destination: 'static + Subscriber<In = In, InError = <InnerObservable as ObservableOutput>::OutError>,
Source§impl<In, InError, Mapper, InnerObservable, HigherOrderSubscriber, ErrorMapper, Destination> SubscriptionLike for HigherOrderMapSubscriber<In, InError, Mapper, InnerObservable, HigherOrderSubscriber, ErrorMapper, Destination>where
In: Signal,
InError: Signal,
Mapper: FnMut(In) -> InnerObservable,
InnerObservable: Observable + Signal,
HigherOrderSubscriber: HigherOrderSubscriberProvider,
ErrorMapper: 'static + FnOnce(InError) -> <InnerObservable as ObservableOutput>::OutError + Send + Sync,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
impl<In, InError, Mapper, InnerObservable, HigherOrderSubscriber, ErrorMapper, Destination> SubscriptionLike for HigherOrderMapSubscriber<In, InError, Mapper, InnerObservable, HigherOrderSubscriber, ErrorMapper, Destination>where
In: Signal,
InError: Signal,
Mapper: FnMut(In) -> InnerObservable,
InnerObservable: Observable + Signal,
HigherOrderSubscriber: HigherOrderSubscriberProvider,
ErrorMapper: 'static + FnOnce(InError) -> <InnerObservable as ObservableOutput>::OutError + Send + Sync,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
Source§impl<In, InError, Mapper, Out, Destination> SubscriptionLike for MapSubscriber<In, InError, Mapper, Out, Destination>
impl<In, InError, Mapper, Out, Destination> SubscriptionLike for MapSubscriber<In, InError, Mapper, Out, Destination>
Source§impl<In, InError, OnNext, Destination> SubscriptionLike for TapNextSubscriber<In, InError, OnNext, Destination>where
OnNext: 'static + FnMut(&In),
Destination: Subscriber<In = In, InError = InError>,
In: Signal,
InError: Signal,
impl<In, InError, OnNext, Destination> SubscriptionLike for TapNextSubscriber<In, InError, OnNext, Destination>where
OnNext: 'static + FnMut(&In),
Destination: Subscriber<In = In, InError = InError>,
In: Signal,
InError: Signal,
Source§impl<In, InError, Out, OutError, Destination> SubscriptionLike for MapIntoSubscriber<In, InError, Out, OutError, Destination>
impl<In, InError, Out, OutError, Destination> SubscriptionLike for MapIntoSubscriber<In, InError, Out, OutError, Destination>
Source§impl<In, InError, P, Destination> SubscriptionLike for FindIndexSubscriber<In, InError, P, Destination>where
In: Signal,
InError: Signal,
P: Fn(&In) -> bool,
Destination: Subscriber<In = usize, InError = FindIndexOperatorError<InError>>,
impl<In, InError, P, Destination> SubscriptionLike for FindIndexSubscriber<In, InError, P, Destination>where
In: Signal,
InError: Signal,
P: Fn(&In) -> bool,
Destination: Subscriber<In = usize, InError = FindIndexOperatorError<InError>>,
Source§impl<In, InError, Reducer, Out, Destination> SubscriptionLike for ReduceSubscriber<In, InError, Reducer, Out, Destination>
impl<In, InError, Reducer, Out, Destination> SubscriptionLike for ReduceSubscriber<In, InError, Reducer, Out, Destination>
Source§impl<In, InError, Reducer, Out, Destination> SubscriptionLike for ScanSubscriber<In, InError, Reducer, Out, Destination>
impl<In, InError, Reducer, Out, Destination> SubscriptionLike for ScanSubscriber<In, InError, Reducer, Out, Destination>
Source§impl<In, InError, S> SubscriptionLike for Box<S>
impl<In, InError, S> SubscriptionLike for Box<S>
Source§impl<In, InnerObservable, Destination> SubscriptionLike for WithLatestFromSubscriber<In, InnerObservable, Destination>where
In: Signal,
InnerObservable: Observable,
<InnerObservable as ObservableOutput>::Out: Clone,
Destination: Subscriber<In = (In, <InnerObservable as ObservableOutput>::Out), InError = <InnerObservable as ObservableOutput>::OutError>,
impl<In, InnerObservable, Destination> SubscriptionLike for WithLatestFromSubscriber<In, InnerObservable, Destination>where
In: Signal,
InnerObservable: Observable,
<InnerObservable as ObservableOutput>::Out: Clone,
Destination: Subscriber<In = (In, <InnerObservable as ObservableOutput>::Out), InError = <InnerObservable as ObservableOutput>::OutError>,
Source§impl<InError, Destination> SubscriptionLike for FirstSubscriber<InError, Destination>
impl<InError, Destination> SubscriptionLike for FirstSubscriber<InError, Destination>
Source§impl<InError, Destination, S> SubscriptionLike for AdsrSubscriber<InError, Destination, S>
impl<InError, Destination, S> SubscriptionLike for AdsrSubscriber<InError, Destination, S>
Source§impl<InError, P, Destination> SubscriptionLike for FindSubscriber<InError, P, Destination>where
InError: Signal,
P: Fn(&<Destination as ObserverInput>::In) -> bool,
Destination: Subscriber<InError = FindOperatorError<InError>>,
impl<InError, P, Destination> SubscriptionLike for FindSubscriber<InError, P, Destination>where
InError: Signal,
P: Fn(&<Destination as ObserverInput>::In) -> bool,
Destination: Subscriber<InError = FindOperatorError<InError>>,
Source§impl<Inner, Destination> SubscriptionLike for CompositeSubscriber<Inner, Destination>where
Inner: Subscriber,
Destination: RxObserver,
impl<Inner, Destination> SubscriptionLike for CompositeSubscriber<Inner, Destination>where
Inner: Subscriber,
Destination: RxObserver,
Source§impl<InnerObservable, Destination> SubscriptionLike for ConcurrentSubscriber<InnerObservable, Destination>where
InnerObservable: Observable<Out = <Destination as ObserverInput>::In, OutError = <Destination as ObserverInput>::InError> + Signal,
Destination: 'static + Subscriber,
impl<InnerObservable, Destination> SubscriptionLike for ConcurrentSubscriber<InnerObservable, Destination>where
InnerObservable: Observable<Out = <Destination as ObserverInput>::In, OutError = <Destination as ObserverInput>::InError> + Signal,
Destination: 'static + Subscriber,
Source§impl<InnerObservable, Destination> SubscriptionLike for ExhaustSubscriber<InnerObservable, Destination>where
InnerObservable: Observable + Signal,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
impl<InnerObservable, Destination> SubscriptionLike for ExhaustSubscriber<InnerObservable, Destination>where
InnerObservable: Observable + Signal,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
Source§impl<InnerObservable, Destination> SubscriptionLike for SwitchSubscriber<InnerObservable, Destination>where
InnerObservable: Observable + Signal,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
impl<InnerObservable, Destination> SubscriptionLike for SwitchSubscriber<InnerObservable, Destination>where
InnerObservable: Observable + Signal,
Destination: 'static + Subscriber<In = <InnerObservable as ObservableOutput>::Out, InError = <InnerObservable as ObservableOutput>::OutError>,
Source§impl<O> SubscriptionLike for Option<O>where
O: SubscriptionLike,
impl<O> SubscriptionLike for Option<O>where
O: SubscriptionLike,
Source§impl<OnNext, Destination> SubscriptionLike for OnNextSubscriber<OnNext, Destination>where
OnNext: 'static + FnMut(&<Destination as ObserverInput>::In, &mut dyn Subscriber<In = <Destination as ObserverInput>::In, InError = <Destination as ObserverInput>::InError>) -> bool + Send + Sync,
Destination: Subscriber,
impl<OnNext, Destination> SubscriptionLike for OnNextSubscriber<OnNext, Destination>where
OnNext: 'static + FnMut(&<Destination as ObserverInput>::In, &mut dyn Subscriber<In = <Destination as ObserverInput>::In, InError = <Destination as ObserverInput>::InError>) -> bool + Send + Sync,
Destination: Subscriber,
Source§impl<ResultIn, ResultInError, InError, Destination> SubscriptionLike for LiftResultSubscriber<ResultIn, ResultInError, InError, Destination>where
ResultIn: Signal,
ResultInError: Signal,
InError: Signal,
Destination: Subscriber<In = ResultIn, InError = ResultInError>,
impl<ResultIn, ResultInError, InError, Destination> SubscriptionLike for LiftResultSubscriber<ResultIn, ResultInError, InError, Destination>where
ResultIn: Signal,
ResultInError: Signal,
InError: Signal,
Destination: Subscriber<In = ResultIn, InError = ResultInError>,
Source§impl<State, OnComplete, OnUnsubscribe, Destination> SubscriptionLike for HigherOrderInnerSubscriber<State, OnComplete, OnUnsubscribe, Destination>where
State: HigherOrderSubscriberStateConditions,
OnComplete: FnOnce(usize),
OnUnsubscribe: FnOnce(usize),
Destination: 'static + Subscriber,
impl<State, OnComplete, OnUnsubscribe, Destination> SubscriptionLike for HigherOrderInnerSubscriber<State, OnComplete, OnUnsubscribe, Destination>where
State: HigherOrderSubscriberStateConditions,
OnComplete: FnOnce(usize),
OnUnsubscribe: FnOnce(usize),
Destination: 'static + Subscriber,
Source§impl<TapDestination, Destination> SubscriptionLike for TapSubscriber<TapDestination, Destination>where
TapDestination: 'static + RxObserver<In = <Destination as ObserverInput>::In, InError = <Destination as ObserverInput>::InError> + Send + Sync,
Destination: Subscriber,
impl<TapDestination, Destination> SubscriptionLike for TapSubscriber<TapDestination, Destination>where
TapDestination: 'static + RxObserver<In = <Destination as ObserverInput>::In, InError = <Destination as ObserverInput>::InError> + Send + Sync,
Destination: Subscriber,
Source§impl<VariantSelector, Destination, O1, O2> SubscriptionLike for EitherSubscriber2<VariantSelector, Destination, O1, O2>where
VariantSelector: EitherNotificationSelector2<O1, O2>,
Destination: Subscriber<In = EitherObservableNotification2<O1, O2>>,
O1: Observable,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: Observable,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
impl<VariantSelector, Destination, O1, O2> SubscriptionLike for EitherSubscriber2<VariantSelector, Destination, O1, O2>where
VariantSelector: EitherNotificationSelector2<O1, O2>,
Destination: Subscriber<In = EitherObservableNotification2<O1, O2>>,
O1: Observable,
<O1 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
O2: Observable,
<O2 as ObservableOutput>::OutError: Into<<Destination as ObserverInput>::InError>,
Implementors§
impl SubscriptionLike for ErasedSubscription
impl SubscriptionLike for SubscriptionData
impl<Destination> SubscriptionLike for ObserverSubscriber<Destination>where
Destination: RxObserver,
impl<Destination> SubscriptionLike for Subscription<Destination>where
Destination: Subscriber,
impl<In, InError> SubscriptionLike for PrintObserver<In, InError>
impl<In, InError> SubscriptionLike for ErasedSubscriber<In, InError>
impl<In, InError> SubscriptionLike for BehaviorSubject<In, InError>
impl<In, InError> SubscriptionLike for PublishSubject<In, InError>
A subject is both an observable and an observer, but they are NOT subscriptions! And traditionally they do not allow to forcibly unsubscribe all subscribers, besides just marking the subject as closed once completed or errored.
The reason is, that when a subject is used as a destination of a subscription, it should only forward signals, but should definitely NOT unsubscribe the subscribers. That subject could be used as a destination for multiple subscriptions, one should not close it from others, unless it completes or errors it.
But here that does not happen, because Observables here in rx_core expect
not an observer, but an UpgradeableObserver. And it’s up to the
destination to decide if it wants to be unsubscribed together with upstream
or not. (This exists to be able to use subscribers directly as destinations)
This trait is autoimplemented by the RxSubject macro and makes subjects
always be wrapped in a DetatchedSubscriber which only forwards signals
but not unsubscribe calls.
Publish, Behavior, Replay and Async subjects all upgrade to a detached subscriber, but other subjects implement it at their own discretion. The RxSubject macro intentionally makes this the default behavior, so if a custom subject does not detach on subscribe, it’s most likely intentional.
So you get to pass subjects as destinations without worrying that it unsubscribes when it shouldn’t, but you can still do it by hand and drop all subscribers.