Skip to main content

GateContract

Trait GateContract 

Source
pub trait GateContract: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn assert_inserted(
        &self,
        sub_graph: &GraphProto,
    ) -> Result<(), CompileError>;
}
Expand description

A single insertion contract a gate-inserting pass owns.

assert_inserted runs on every per-role sub-graph after the gate-insertion phase; it returns Ok(()) when the gate this contract represents is consistent with the graph the validator observes (either absent because nothing needs it, OR present in the canonical insertion shape).

Required Methods§

Source

fn name(&self) -> &'static str

Diagnostic label for the contract (e.g. "DeadlineCheck"). Surfaced in CompileError::RuntimeIncomplete so the host sees which contract failed.

Source

fn assert_inserted(&self, sub_graph: &GraphProto) -> Result<(), CompileError>

Assert the contract holds on sub_graph. Returns Err(CompileError::RuntimeIncomplete { ... }) with a human-readable description when the gate’s insertion is incomplete.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§