pub trait Recipe {
type Output;
// Required methods
fn hash(&self, state: &mut FxHasher);
fn stream(
self: Box<Self>,
input: Pin<Box<dyn Stream<Item = Event> + Send>>,
) -> Pin<Box<dyn Stream<Item = Self::Output> + Send>>;
}
Available on crate feature
advanced
only.Expand description
The description of a Subscription
.
A Recipe
is the internal definition of a Subscription
. It is used
by runtimes to run and identify subscriptions. You can use it to create your
own!
§Examples
The repository has a couple of examples that use a custom Recipe
:
download_progress
, a basic application that asynchronously downloads a dummy file of 100 MB and tracks the download progress.stopwatch
, a watch with start/stop and reset buttons showcasing how to listen to time.
Required Associated Types§
Sourcetype Output
type Output
The events that will be produced by a Subscription
with this
Recipe
.
Required Methods§
Sourcefn hash(&self, state: &mut FxHasher)
fn hash(&self, state: &mut FxHasher)
Hashes the Recipe
.
This is used by runtimes to uniquely identify a Subscription
.