pub trait RuntimeOps: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn now_nanos(&self) -> u64;
fn unix_time(&self) -> Option<(u64, u32)>;
fn sleep(&self, d: Duration) -> BoxFuture;
fn log(&self, level: LogLevel, msg: &str);
}Expand description
Object-safe runtime capabilities: identity, time, sleep, and logging.
Implemented by every runtime adapter (TokioAdapter, EmbassyAdapter,
WasmAdapter) so a runtime can travel as Arc<dyn RuntimeOps> instead of
a generic parameter.
Required Methods§
Sourcefn now_nanos(&self) -> u64
fn now_nanos(&self) -> u64
Monotonic clock reading in nanoseconds from an arbitrary epoch.
Only differences between two readings are meaningful. Never decreases;
saturates at u64::MAX rather than wrapping.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".