Skip to main content

BrainPack

Struct BrainPack 

Source
pub struct BrainPack { /* private fields */ }

Implementations§

Source§

impl BrainPack

Source

pub fn new(runtime: KhiveRuntime) -> Self

Source

pub fn snapshot(&self) -> BrainStateSnapshot

Public snapshot of the current BrainState.

Equivalent to dispatching the brain.state verb but callable directly when you hold an Arc<BrainPack> (e.g. a test that registered the pack as a DispatchHook and wants to verify posteriors updated).

Trait Implementations§

Source§

impl DispatchHook for BrainPack

BrainPack as a post-dispatch hook (Issue #158).

When registered via VerbRegistryBuilder::with_dispatch_hook, every successful verb dispatch calls on_dispatch with a synthesized Event. The event is fed into EventFold::step, updating the brain’s posteriors in real time — no polling required.

This is opt-in: the hook must be explicitly registered. Registries that do not load the brain pack are unaffected.

Source§

fn on_dispatch<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 Event, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called with the dispatch-outcome event after a successful pack dispatch. Read more
Source§

impl Pack for BrainPack

Source§

const NAME: &'static str = "brain"

Short identifier for this pack (e.g. “kg”, “tasks”).
Source§

const NOTE_KINDS: &'static [&'static str]

Note kinds this pack contributes to the runtime vocabulary.
Source§

const ENTITY_KINDS: &'static [&'static str]

Entity kinds this pack contributes to the runtime vocabulary.
Source§

const VERBS: &'static [VerbDef]

Verbs this pack handles. The runtime routes verb calls to the pack that declares them.
Source§

const REQUIRES: &'static [&'static str]

Other pack names whose vocabulary this pack references (ADR-037). Read more
Source§

const EDGE_RULES: &'static [EdgeEndpointRule] = _

Additional edge endpoint rules this pack contributes (ADR-031). Read more
Source§

impl PackRuntime for BrainPack

Source§

fn name(&self) -> &str

Pack name — must equal <Self as Pack>::NAME.
Source§

fn note_kinds(&self) -> &'static [&'static str]

Note kinds this pack owns — must equal <Self as Pack>::NOTE_KINDS.
Source§

fn entity_kinds(&self) -> &'static [&'static str]

Entity kinds this pack owns — must equal <Self as Pack>::ENTITY_KINDS.
Source§

fn verbs(&self) -> &'static [VerbDef]

Verbs this pack handles — must equal <Self as Pack>::VERBS.
Source§

fn requires(&self) -> &'static [&'static str]

Pack names whose vocabulary this pack references (ADR-037). Defaults to empty so existing packs compile without changes.
Source§

fn dispatch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, verb: &'life1 str, params: Value, _registry: &'life2 VerbRegistry, ) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dispatch a verb call. Returns serialized JSON response. Read more
Source§

fn edge_rules(&self) -> &'static [EdgeEndpointRule]

Pack-extensible edge endpoint rules — must equal <Self as Pack>::EDGE_RULES. Defaults to empty so existing packs that don’t extend the edge contract can ignore it (ADR-031).
Source§

fn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>>

Optional per-kind hook for shared CRUD specialization (ADR-030). 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