1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Time primitives: sleep, timeout, and interval operations.
//!
//! This module provides core time-based operations for async programming:
//! - [`Sleep`]: A future that completes after a deadline
//! - [`TimeoutFuture`]: A wrapper that adds a timeout to any future
//! - [`Interval`]: A repeating timer that yields at a fixed period
//!
//! # Virtual vs Wall Time
//!
//! These primitives work with both production (wall clock) time and
//! virtual time in the lab runtime. The time source is determined by
//! the runtime context.
//!
//! # Cancel Safety
//!
//! All time primitives are cancel-safe:
//! - `Sleep`: Can be dropped and recreated without side effects
//! - `TimeoutFuture`: The inner future may have side effects on cancellation
//! - `Interval`: Next tick proceeds from where it was interrupted
//!
//! # Example
//!
//! ```ignore
//! use asupersync::time::{sleep, timeout, interval};
//! use std::time::Duration;
//!
//! // Sleep for 100 milliseconds
//! sleep(Duration::from_millis(100)).await;
//!
//! // Wrap an operation with a timeout
//! match timeout(Duration::from_secs(5), async { expensive_operation() }).await {
//! Ok(result) => println!("Completed: {result}"),
//! Err(_) => println!("Timed out!"),
//! }
//!
//! // Create an interval timer
//! let mut ticker = interval(now, Duration::from_millis(100));
//! for _ in 0..5 {
//! let tick = ticker.tick(now);
//! process_tick(tick);
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use Elapsed;
pub use ;
pub use ;
pub use ;
pub use ;