[][src]Function seed::app::streams::interval

pub fn interval<MsU>(
    ms: u32,
    handler: impl FnOnce() -> MsU + Clone + 'static
) -> impl Stream<Item = MsU>

Stream no values on predefined time interval in milliseconds.

Handler has to return Msg, Option<Msg> or ().

Example

orders.stream(streams::interval(1000, || Msg::OnTick));
orders.stream_with_handle(streams::interval(1000, || log!("Tick!")));

Panics

Panics when the handler doesn't return Msg, Option<Msg> or (). (It will be changed to a compile-time error).