pub trait RuntimeOps: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn sleep(&self, d: Duration) -> BoxFuture;
fn log(&self, level: LogLevel, msg: &str);
fn new_clock(&self) -> Arc<dyn InstanceClock> ⓘ;
}Expand description
Object-safe runtime capabilities: identity, clock, sleep, and logging.
Time is read from the InstanceClock this trait creates, never from the
runtime itself (design 058 §3.1).
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 log(&self, level: LogLevel, msg: &str)
fn log(&self, level: LogLevel, msg: &str)
Emits msg at level through the adapter’s logging backend.
Sourcefn new_clock(&self) -> Arc<dyn InstanceClock> ⓘ
fn new_clock(&self) -> Arc<dyn InstanceClock> ⓘ
Creates a new clock whose monotonic origin is the moment of this call.
Called once by AimDbBuilder::build(); every write of the instance is
stamped from the returned clock, whichever thread, task or runtime
performs it (design 058 §3). Code outside an instance (a standalone
client engine) creates its own through RuntimeContext::new.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".