pub trait Intercept:
WasmCompatSend
+ WasmCompatSync
+ 'static {
// Required methods
fn name(&self) -> String;
fn before(
&self,
id: EffectId,
kind: &EffectKind,
) -> impl Future<Output = BeforeServe> + WasmCompatSend;
fn after(
&self,
id: EffectId,
kind: &EffectKind,
outcome: &Result<Answered, ErrorReport>,
) -> impl Future<Output = AfterServe> + WasmCompatSend;
}Expand description
Host policy before a handler and after its first answer. A suspended verdict keeps execution in flight; driver cancellation drops its future. Streamed verdict futures are polled on the stream consumer’s thread. The layer name identifies policy when recording and validating replay.
Required Methods§
Sourcefn before(
&self,
id: EffectId,
kind: &EffectKind,
) -> impl Future<Output = BeforeServe> + WasmCompatSend
fn before( &self, id: EffectId, kind: &EffectKind, ) -> impl Future<Output = BeforeServe> + WasmCompatSend
Before the handler: the dispatch as it will be served, or not.
Sourcefn after(
&self,
id: EffectId,
kind: &EffectKind,
outcome: &Result<Answered, ErrorReport>,
) -> impl Future<Output = AfterServe> + WasmCompatSend
fn after( &self, id: EffectId, kind: &EffectKind, outcome: &Result<Answered, ErrorReport>, ) -> impl Future<Output = AfterServe> + WasmCompatSend
After the handler: the answer as the consumer will receive it. For a
streaming dispatch outcome is the fold of the events (the
completion the record stores).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".