FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    sleep

    function · ferroui-view · v0.5.0

    fn sleep(duration: std::time::Duration) -> impl Future<Output = ()>
    

    A future that ends after duration, on a timer of the dispatcher of the thread: for a delay in a future of use_future, such as the debouncing of what the user types. The timer starts when the future is first polled; a sleep dropped before it ends (its future was abandoned) stops it.

    let results = use_future(query.get(), |query| {
        let query = query.clone();
        async move {
            sleep(Duration::from_millis(300)).await;
            search(&query).await
        }
    });
    

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.