Skip to main content

PackRuntime

Trait PackRuntime 

Source
pub trait PackRuntime: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn note_kinds(&self) -> &'static [&'static str];
    fn entity_kinds(&self) -> &'static [&'static str];
    fn verbs(&self) -> &'static [VerbDef];
    fn dispatch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        verb: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Async dispatch trait for packs (ADR-025).

This is the object-safe behavioral counterpart to khive_types::Pack. Pack uses const associated items (not object-safe in Rust); this trait mirrors that metadata as methods and adds async dispatch.

Registration requires P: Pack + PackRuntime — the compiler enforces that every runtime pack also declares its vocabulary via Pack.

Required Methods§

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 dispatch<'life0, 'life1, 'async_trait>( &'life0 self, verb: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dispatch a verb call. Returns serialized JSON response.

Implementors§