Skip to main content

MatchHook

Trait MatchHook 

Source
pub trait MatchHook: Send + Sync {
    // Required methods
    fn symbol(&self) -> Symbol;
    fn kind(&self) -> MatchHookKind;
    fn apply(
        &self,
        cx: &mut Cx,
        ctx: &MatchHookContext,
        current: Option<&ShapeMatch>,
    ) -> Result<MatchHookDecision>;

    // Provided method
    fn object_encoding(&self) -> Option<ObjectEncoding> { ... }
}
Expand description

Runtime hook contract for neutral shape match membranes.

Required Methods§

Source

fn symbol(&self) -> Symbol

Stable symbol naming the hook.

Source

fn kind(&self) -> MatchHookKind

Decision class this hook may produce.

Source

fn apply( &self, cx: &mut Cx, ctx: &MatchHookContext, current: Option<&ShapeMatch>, ) -> Result<MatchHookDecision>

Run the hook for the supplied context and current match state.

Provided Methods§

Source

fn object_encoding(&self) -> Option<ObjectEncoding>

Constructor encoding for pure, descriptor-backed built-in hooks.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§