Skip to main content

VerbRegistryBuilder

Struct VerbRegistryBuilder 

Source
pub struct VerbRegistryBuilder { /* private fields */ }
Expand description

Builder for constructing a VerbRegistry.

Packs are registered here; once .build() is called the registry is immutable and cheaply cloneable.

Implementations§

Source§

impl VerbRegistryBuilder

Source

pub fn new() -> Self

Source

pub fn register<P: Pack + PackRuntime + 'static>( &mut self, pack: P, ) -> &mut Self

Register a pack. The bound P: Pack + PackRuntime ensures the pack declares vocabulary via Pack consts alongside runtime dispatch.

Source

pub fn with_gate(&mut self, gate: GateRef) -> &mut Self

Set the authorization gate consulted on every dispatch (ADR-029).

Defaults to AllowAllGate if not set. In v0.2 the gate is advisory — deny decisions are logged via tracing::warn! but do not block dispatch.

Source

pub fn with_default_namespace(&mut self, ns: impl Into<String>) -> &mut Self

Set the namespace surfaced to the gate when a verb does not carry an explicit namespace argument. Transports should plumb the runtime’s default_namespace so the gate’s input.namespace always reflects the operation’s true tenant (ADR-029 + ADR-007).

Source

pub fn with_event_store(&mut self, store: Arc<dyn EventStore>) -> &mut Self

Set the EventStore used to persist audit events (ADR-035).

When configured, every gate check appends one Event (substrate = Event, outcome = Success on allow, Denied on deny) in addition to the tracing::info! emission that was already present in v0.2.

Callers that do not set this field continue to use tracing-only emission (the v0.2 default). There is no behavior change for them.

Source

pub fn with_dispatch_hook(&mut self, hook: Arc<dyn DispatchHook>) -> &mut Self

Register a post-dispatch hook (Issue #158).

When set, every successful pack dispatch calls hook.on_dispatch(event) with a synthesized Event describing the verb outcome. The hook is opt-in: registries without a hook incur zero overhead on the dispatch hot path.

Brain pack uses this to update its posteriors in real time without polling the EventStore. Errors from on_dispatch are logged via tracing::warn! and never propagated.

Source

pub fn build(self) -> Result<VerbRegistry, RuntimeError>

Consume the builder and produce an immutable, cloneable registry.

Performs a topological sort of packs using Kahn’s algorithm (ADR-037). Returns an error if any declared dependency is missing from the loaded pack set, or if a circular dependency is detected.

Trait Implementations§

Source§

impl Default for VerbRegistryBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more