pub trait ComposableOperator: ObserverInput + ObservableOutput {
type Subscriber<Destination: 'static + Subscriber<In = Self::Out, InError = Self::OutError> + Send + Sync>: 'static + Subscriber<In = Self::In, InError = Self::InError> + Send + Sync;
// Required method
fn operator_subscribe<Destination>(
&mut self,
destination: Destination,
) -> Self::Subscriber<Destination>
where Destination: 'static + Subscriber<In = Self::Out, InError = Self::OutError> + Send + Sync;
}Expand description
§ComposableOperator
Composable Operators are a subset of regular Operators. Unlike - for
example - the retry operator, that (as the name suggests) retries
subscription to the source, many other operators do not interact with their
source observable beyond just subscribing to them once.
They simply subscribe to the source once, and all they do is:
-
Wrap the destination into a subscriber on subscribe
-
And/Or Interact with the destination on subscribe
The
start_withandfinalizeoperators don’t create anything new on subscribe, they only interact with the destination subscriber.
But they don’t know anything about who the source observable is.
This is what makes them composable, allowing the creation of new ComposableOperators out of existing ones. As they are all just arrangements of nested functions that apply layers of behavior onto a subscriber.
§Pipe
The Pipe observable, together with ComposeOperator, makes all ComposableOperators automatically impl Operator too.
Required Associated Types§
type Subscriber<Destination: 'static + Subscriber<In = Self::Out, InError = Self::OutError> + Send + Sync>: 'static + Subscriber<In = Self::In, InError = Self::InError> + Send + Sync
Required Methods§
fn operator_subscribe<Destination>( &mut self, destination: Destination, ) -> Self::Subscriber<Destination>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<In, InError, Op> ComposableOperator for Option<Op>where
Op: ComposableOperator<In = In, InError = InError, Out = In, OutError = InError>,
In: Signal,
InError: Signal,
[Operator]s with the same outputs as its inputs can be made optional.
impl<In, InError, Op> ComposableOperator for Option<Op>where
Op: ComposableOperator<In = In, InError = InError, Out = In, OutError = InError>,
In: Signal,
InError: Signal,
[Operator]s with the same outputs as its inputs can be made optional.
If upon subscription, the operator was Some the subscription will be created with the operator, if it’s None, values will just pass through.