This is a safe Rust library providing async sleep_for
and sleep_until
functions.
These functions return futures that complete at the specified time.
It works well with safina
.
forbid(unsafe_code)
std
std::thread::park_timeout
via
std::sync::mpsc::Receiver::recv_timeout
.nightly
, for OnceCellrust
safina_timer::start_timer_thread();
safina_timer::sleep_for(Duration::from_secs(10)).await.unwrap();
rust
safina_timer::start_timer_thread();
let deadline = Instant::now() + Duration::from_millis(500);
safina_timer::sleep_until(deadline).await.unwrap();
https://docs.rs/safina-timer
unsafe
codestd::thread::park_timeout
as its source of timeunsafe
Cargo.toml
and bump version number../release.sh
SleepFuture::poll
, as required by the
std::future::Future::poll
contract.with_deadline
and with_timeout
functions.sleep_until
sleep_for
License: Apache-2.0