pub struct EffectContext<'a, U = ()> { /* private fields */ }Expand description
Shared context passed to effect handlers during dispatch.
Carries the DataConTable (needed for FromCore/ToCore conversions) and
an optional user-defined state value U that handlers can read.
Implementations§
Source§impl<'a, U> EffectContext<'a, U>
impl<'a, U> EffectContext<'a, U>
Sourcepub fn with_user(table: &'a DataConTable, user: &'a U) -> Self
pub fn with_user(table: &'a DataConTable, user: &'a U) -> Self
Create a new context with a user state value and data constructor table.
Sourcepub fn respond<T: ToCore>(&self, val: T) -> Result<Value, EffectError>
pub fn respond<T: ToCore>(&self, val: T) -> Result<Value, EffectError>
Convert a Rust value into a Core Value suitable for returning to the JIT.
Sourcepub fn table(&self) -> &DataConTable
pub fn table(&self) -> &DataConTable
Access the data constructor table (for manual FromCore/ToCore calls).
Auto Trait Implementations§
impl<'a, U> Freeze for EffectContext<'a, U>
impl<'a, U> RefUnwindSafe for EffectContext<'a, U>where
U: RefUnwindSafe,
impl<'a, U> Send for EffectContext<'a, U>where
U: Sync,
impl<'a, U> Sync for EffectContext<'a, U>where
U: Sync,
impl<'a, U> Unpin for EffectContext<'a, U>
impl<'a, U> UnsafeUnpin for EffectContext<'a, U>
impl<'a, U> UnwindSafe for EffectContext<'a, U>where
U: RefUnwindSafe,
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