pub struct RuntimeContext { /* private fields */ }Expand description
Unified runtime context for AimDB services
Wraps the dyn-safe RuntimeOps capability surface and a clock so
services can use timing and logging without knowing the runtime adapter
type. Cheap to clone (two Arcs).
Every context an AimDb hands out carries the instance clock, the one that
stamps writes (design 058 §3.1).
Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn new(ops: Arc<dyn RuntimeOps>) -> Self
pub fn new(ops: Arc<dyn RuntimeOps>) -> Self
A context with a clock of its own, created now — for code outside an
instance, such as a standalone client engine. Inside an instance use
AimDb::runtime_ctx(), which shares the instance clock.
Sourcepub fn with_clock(
ops: Arc<dyn RuntimeOps>,
clock: Arc<dyn InstanceClock>,
) -> Self
pub fn with_clock( ops: Arc<dyn RuntimeOps>, clock: Arc<dyn InstanceClock>, ) -> Self
A context over ops that reads time from clock.
Sourcepub fn time(&self) -> Time<'_>
pub fn time(&self) -> Time<'_>
Access time utilities
Returns a time accessor for clock reads and sleeping.
Sourcepub fn clock(&self) -> &Arc<dyn InstanceClock> ⓘ
pub fn clock(&self) -> &Arc<dyn InstanceClock> ⓘ
The clock this context reads time from.
Sourcepub fn ops(&self) -> &Arc<dyn RuntimeOps> ⓘ
pub fn ops(&self) -> &Arc<dyn RuntimeOps> ⓘ
Direct access to the underlying runtime capabilities.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RuntimeContext
impl !UnwindSafe for RuntimeContext
impl Freeze for RuntimeContext
impl Send for RuntimeContext
impl Sync for RuntimeContext
impl Unpin for RuntimeContext
impl UnsafeUnpin for RuntimeContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more