pub struct BrainPack { /* private fields */ }Implementations§
Source§impl BrainPack
impl BrainPack
pub fn new(runtime: KhiveRuntime) -> Self
Sourcepub fn snapshot(&self) -> BrainStateSnapshot
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).
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,
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
impl Pack for BrainPack
Source§const NOTE_KINDS: &'static [&'static str]
const NOTE_KINDS: &'static [&'static str]
Note kinds this pack contributes to the runtime vocabulary.
Source§const ENTITY_KINDS: &'static [&'static str]
const ENTITY_KINDS: &'static [&'static str]
Entity kinds this pack contributes to the runtime vocabulary.
Source§const VERBS: &'static [VerbDef]
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]
const REQUIRES: &'static [&'static str]
Other pack names whose vocabulary this pack references (ADR-037). Read more
Source§const EDGE_RULES: &'static [EdgeEndpointRule] = _
const EDGE_RULES: &'static [EdgeEndpointRule] = _
Additional edge endpoint rules this pack contributes (ADR-031). Read more
Source§impl PackRuntime for BrainPack
impl PackRuntime for BrainPack
Source§fn note_kinds(&self) -> &'static [&'static str]
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]
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]
fn verbs(&self) -> &'static [VerbDef]
Verbs this pack handles — must equal
<Self as Pack>::VERBS.Source§fn requires(&self) -> &'static [&'static str]
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,
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]
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).Auto Trait Implementations§
impl !Freeze for BrainPack
impl !RefUnwindSafe for BrainPack
impl Send for BrainPack
impl Sync for BrainPack
impl Unpin for BrainPack
impl UnsafeUnpin for BrainPack
impl !UnwindSafe for BrainPack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more