Skip to content

A utility that provides timeouts for futures and streams

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

dariusc93/futures-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

futures-timeout

A simple utility that provides timeouts for futures and streams, which utilizes futures-timer. This library is compatible with wasm32-unknown-unknown target.

fn main() {
    futures::executor::block_on(async move {
        use std::time::Duration;
        use futures_timeout::TimeoutExt;
        
        let fut = async {
            futures_timer::Delay::new(Duration::from_secs(30)).await;
        };

        fut.timeout(Duration::from_secs(5))
            .await
            .expect_err("should fail");
    });
}

About

A utility that provides timeouts for futures and streams

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages