pub struct Effect {
pub id: Ref,
pub kind: Symbol,
pub subject: Ref,
pub input: Ref,
pub result_shape: Ref,
pub resume_op: OpKey,
pub abort_op: OpKey,
pub requires: Vec<CapabilityName>,
pub replay_key: Option<ContentId>,
}Expand description
A capability-gated request resolved by an effect handler.
Fields§
§id: RefFresh handle identifying this effect occurrence.
kind: SymbolSymbol naming the effect kind.
subject: RefReference to the effect’s subject.
input: RefReference to the effect’s input.
result_shape: RefShape the effect result must satisfy.
resume_op: OpKeyOperation key used to resume the effect.
abort_op: OpKeyOperation key used to abort the effect.
requires: Vec<CapabilityName>Capabilities the caller must hold for the effect to run.
replay_key: Option<ContentId>Content-addressed replay key, once computed.
Implementations§
Source§impl Effect
impl Effect
Sourcepub fn new(
kind: Symbol,
subject: Ref,
input: Ref,
result_shape: Ref,
resume_op: OpKey,
abort_op: OpKey,
) -> Self
pub fn new( kind: Symbol, subject: Ref, input: Ref, result_shape: Ref, resume_op: OpKey, abort_op: OpKey, ) -> Self
Build an effect with a fresh handle id and no requirements.
Sourcepub fn requiring(self, capability: CapabilityName) -> Self
pub fn requiring(self, capability: CapabilityName) -> Self
Add one required capability to the effect.
Sourcepub fn with_requirements(self, requires: Vec<CapabilityName>) -> Self
pub fn with_requirements(self, requires: Vec<CapabilityName>) -> Self
Replace the effect’s required capabilities.
Sourcepub fn with_replay_key(self, implementation: Option<Ref>) -> Result<Self>
pub fn with_replay_key(self, implementation: Option<Ref>) -> Result<Self>
Compute and attach the replay key for the given implementation.
Trait Implementations§
impl Eq for Effect
impl StructuralPartialEq for Effect
Auto Trait Implementations§
impl Freeze for Effect
impl RefUnwindSafe for Effect
impl Send for Effect
impl Sync for Effect
impl Unpin for Effect
impl UnsafeUnpin for Effect
impl UnwindSafe for Effect
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