pub struct Ctx<'a, P: Package> { /* private fields */ }Expand description
The entry to state that command functions receive.
Effect commands get &mut Ctx<P>, query commands get &Ctx<P>. They can read and write only the state slice and
persistent slice of their own package P, and can read the state of other packages only for those declared in
P::DEPENDS (Ctx::dep). There is no time and no files.
Implementations§
Source§impl<'a, P: Package> Ctx<'a, P>
impl<'a, P: Package> Ctx<'a, P>
Sourcepub fn interrupted(&self) -> bool
pub fn interrupted(&self) -> bool
Whether an interrupt is requested for the running VM (spec/host/01-execution.md, 1.9a). A long command checks this
now and then, and returns CommandError::interrupted if it is true.
Sourcepub fn state_mut(&mut self) -> &mut P::State
pub fn state_mut(&mut self) -> &mut P::State
The state slice of its own package (write). Only effect commands receive &mut Ctx.
Sourcepub fn persistent(&self) -> &P::Persistent
pub fn persistent(&self) -> &P::Persistent
The persistent slice of its own package (read).
Sourcepub fn persistent_mut(&mut self) -> &mut P::Persistent
pub fn persistent_mut(&mut self) -> &mut P::Persistent
The persistent slice of its own package (write). Not undone by rollback.
Auto Trait Implementations§
impl<'a, P> !RefUnwindSafe for Ctx<'a, P>
impl<'a, P> !UnwindSafe for Ctx<'a, P>
impl<'a, P> Forget for Ctx<'a, P>
impl<'a, P> Freeze for Ctx<'a, P>
impl<'a, P> Move for Ctx<'a, P>
impl<'a, P> Send for Ctx<'a, P>
impl<'a, P> Sync for Ctx<'a, P>
impl<'a, P> Unpin for Ctx<'a, P>
impl<'a, P> UnsafeUnpin for Ctx<'a, P>
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