SessionSignals

Struct SessionSignals 

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

Tracks session-level signals automatically from events.

Every call to on_event updates the corresponding keys under session: in the shared State, making them available to instruction templates, watchers, and computed vars.

Performance: Timestamps use AtomicU64 (nanos since session start) instead of Mutex<Instant>. Derived timing signals are flushed periodically via flush_timing() (100ms interval) rather than per-event.

Implementations§

Source§

impl SessionSignals

Source

pub fn new(state: State) -> Self

Create a new SessionSignals backed by the given State.

Source

pub fn on_event(&self, event: &SessionEvent)

Process an event — updates state keys and atomic timestamps.

This is the per-event handler. It updates boolean flags, counters, and atomic timestamps. Derived timing (silence_ms, elapsed_ms, remaining_budget_ms) is NOT computed here — call flush_timing() periodically instead.

Source

pub fn flush_timing(&self)

Flush derived timing signals to state.

Call this periodically (e.g., every 100ms) from the telemetry lane. Computes silence_ms, elapsed_ms, and remaining_budget_ms from atomic timestamps without any mutex locks.

Source

pub fn session_type(&self) -> SessionType

Returns the current session type based on whether video has been sent.

Source

pub fn latest_resume_handle(&self) -> Option<String>

Returns the latest resumption handle for reconnection.

Source

pub fn mark_video_sent(&self)

Mark that video has been sent (changes session type to AudioVideo).

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.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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