use tokio::sync::oneshot; use tokio::time::{self, timeout, timeout_at, Instant}; use tokio_test::*;
use futures::future::pending; use std::time::Duration;
#[tokio::test] asyncfn simultaneous_deadline_future_completion() { // Create a future that is immediately ready letmut fut = task::spawn(timeout_at(Instant::now(), async {}));
// Ready!
assert_ready_ok!(fut.poll());
}
#[cfg_attr(target_os = "wasi", ignore = "FIXME: `fut.poll()` panics on Wasi")] #[tokio::test] asyncfn completed_future_past_deadline() { // Wrap it with a deadline letmut fut = task::spawn(timeout_at(Instant::now() - ms(1000), async {}));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.