iced::stream

Function channel

Source
pub fn channel<T, F>(
    size: usize,
    f: impl FnOnce(Sender<T>) -> F,
) -> impl Stream<Item = T>
where F: Future<Output = ()>,
Expand description

Creates a new Stream that produces the items sent from a Future to the [mpsc::Sender] provided to the closure.

This is a more ergonomic [stream::unfold], which allows you to go from the “world of futures” to the “world of streams” by simply looping and publishing to an async channel from inside a Future.