Trait iced_native::subscription::Recipe[][src]

pub trait Recipe<Hasher, Event> where
    Hasher: Hasher
{ type Output; pub fn hash(&self, state: &mut Hasher);
pub fn stream(
        self: Box<Self, Global>,
        input: Pin<Box<dyn Stream<Item = Event> + 'static + Send, Global>>
    ) -> Pin<Box<dyn Stream<Item = Self::Output> + 'static + Send, Global>>; }

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.

Associated Types

type Output[src]

The events that will be produced by a Subscription with this Recipe.

Loading content...

Required methods

pub fn hash(&self, state: &mut Hasher)[src]

Hashes the Recipe.

This is used by runtimes to uniquely identify a Subscription.

pub fn stream(
    self: Box<Self, Global>,
    input: Pin<Box<dyn Stream<Item = Event> + 'static + Send, Global>>
) -> Pin<Box<dyn Stream<Item = Self::Output> + 'static + Send, Global>>
[src]

Executes the Recipe and produces the stream of events of its Subscription.

It receives some stream of generic events, which is normally defined by shells.

Loading content...

Implementors

Loading content...