Skip to main content

EffectGate

Trait EffectGate 

pub trait EffectGate: Send + 'static {
    // Required method
    fn with_effect<R>(
        &self,
        effect: impl FnOnce() -> Result<R, String>,
    ) -> Result<R, String>;
}
Expand description

Custody of a delayed host effect. A scoped chooser or URI request carries the caller that asked for it, and the worker rechecks that caller immediately before the host effect runs; an expired caller never reaches the effect.

Required Methods§

fn with_effect<R>( &self, effect: impl FnOnce() -> Result<R, String>, ) -> Result<R, String>

Run effect only while the original caller is still admitted.

§Errors

The caller’s refusal when it is no longer admitted, or effect’s own error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl EffectGate for ResourceEffectScope

A scoped chooser or URI request rechecks this admitted caller on the host’s worker immediately before the effect.