Skip to main content

SessionProjection

Struct SessionProjection 

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

A Projection that folds the agent vocabulary for a single namespace into a SessionState — the session transcript and status. Events from other namespaces are skipped.

Implementations§

Source§

impl SessionProjection

Source

pub fn new(namespace: impl Into<String>) -> Self

Creates an empty projection scoped to namespace.

Trait Implementations§

Source§

impl NamespaceScoped for SessionProjection

Source§

fn new_for(namespace: &str) -> Self

Constructs the projection already scoped to namespace.
Source§

impl Projection for SessionProjection

Source§

type Body = EventBody

The payload type this projection folds. Ties the projection to a Salamander<B> with the same B: you can only build a projection from a log whose events carry the payload it knows how to apply. Expressed as an associated type (not a trait parameter) so the generic replay helpers below read as P: Projection with no extra B to thread through.
Source§

type State = SessionState

The derived state this projection maintains.
Source§

fn apply(&mut self, event: &Event<EventBody>)

Apply one event. MUST be deterministic and infallible on valid input: same events in same order => same state, every time, on every machine (DESIGN.md §6, INV-1).
Source§

fn cursor(&self) -> u64

Current cursor: all events with offset < cursor have been applied.
Source§

fn state(&self) -> &Self::State

Read access to derived state.

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, 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, 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.