Skip to main content

RealtimePayloadHistory

Struct RealtimePayloadHistory 

Source
pub struct RealtimePayloadHistory<P> { /* private fields */ }
Expand description

Payloads retained at exact text/audio coordinates for one speech schedule.

Implementations§

Source§

impl<P> RealtimePayloadHistory<P>

Source

pub fn new(schedule: RealtimeSpeechConfig) -> Self

Creates an empty pre-first-frame history bound only to one exact schedule.

A payload contract must be bound before any coordinate payload can be published. This unbound form exists because session batch is not known until the first frame is accepted.

Source

pub fn with_contract(contract: RealtimePayloadContract) -> Self

Creates an empty history bound to one complete payload contract.

Source

pub const fn schedule(&self) -> &RealtimeSpeechConfig

Returns the exact normalized schedule bound to this history.

Source

pub const fn contract(&self) -> Option<&RealtimePayloadContract>

Returns the exact payload contract after first-frame binding.

Source

pub fn bind_or_validate_contract( &mut self, contract: &RealtimePayloadContract, ) -> Result<(), RealtimePayloadHistoryError>

Binds the first complete contract or validates an already-bound history.

Failed validation never changes the current contract or payloads.

Source

pub fn validate_successor( &self, successor: &Self, ) -> Result<(), RealtimePayloadHistoryError>

Validates whether a branch history may replace this canonical history.

Source

pub fn len(&self) -> usize

Returns the number of retained coordinate payloads.

Source

pub fn is_empty(&self) -> bool

Returns whether no payloads are retained.

Source

pub fn validate_schedule( &self, schedule: &RealtimeSpeechConfig, ) -> Result<(), RealtimePayloadHistoryError>

Rejects handoff to any materially different normalized schedule.

Source

pub fn delayed_coordinate( &self, schedule: &RealtimeSpeechConfig, base_position: usize, slot: RealtimeFrameSlot, ) -> Result<RealtimeSlotCoordinate, RealtimePayloadHistoryError>

Resolves an absolute coordinate by adding the exact configured slot delay.

This is only coordinate arithmetic; it does not assign temporal-input or prediction-target meaning to the resulting slot.

Source

pub fn insert( &mut self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, payload: P, ) -> Result<(), RealtimePayloadHistoryError>

Inserts one payload at one exact validated coordinate.

Source

pub fn insert_delayed( &mut self, schedule: &RealtimeSpeechConfig, base_position: usize, slot: RealtimeFrameSlot, payload: P, ) -> Result<RealtimeSlotCoordinate, RealtimePayloadHistoryError>

Calculates one delayed coordinate and inserts its payload atomically.

Source

pub fn insert_many( &mut self, schedule: &RealtimeSpeechConfig, payloads: impl IntoIterator<Item = (RealtimeSlotCoordinate, P)>, ) -> Result<(), RealtimePayloadHistoryError>

Inserts a complete set of coordinate payloads as one publication.

Invalid slots and duplicates are detected before any payload is visible.

Source

pub fn overwrite_many( &mut self, schedule: &RealtimeSpeechConfig, payloads: impl IntoIterator<Item = (RealtimeSlotCoordinate, P)>, ) -> Result<(), RealtimePayloadHistoryError>

Atomically publishes validated coordinate payloads with explicit overwrite semantics.

This is reserved for schedule-authorized placement and target updates. Ordinary admission should use Self::insert_many so accidental duplicate producers still fail closed.

Source

pub fn get( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<Option<&P>, RealtimePayloadHistoryError>

Returns a payload at one exact validated coordinate, when present.

Source

pub fn envelope( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<Option<&RealtimePayloadEnvelope<P>>, RealtimePayloadHistoryError>

Returns the typed envelope at one exact validated coordinate, when present.

Source

pub fn required( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<&P, RealtimePayloadHistoryError>

Resolves one required payload or fails with its exact missing coordinate.

Source

pub fn resolve_required( &self, schedule: &RealtimeSpeechConfig, coordinates: impl IntoIterator<Item = RealtimeSlotCoordinate>, ) -> Result<Vec<&P>, RealtimePayloadHistoryError>

Resolves required coordinates in caller order, retaining duplicate reads.

Source

pub fn prune_for_next_frontier( &mut self, schedule: &RealtimeSpeechConfig, next_frontier: usize, ) -> Result<usize, RealtimePayloadHistoryError>

Prunes coordinates older than the deterministic delayed-history window.

For next frontier n and maximum delay d, positions before n - (d + 2) are removed. The additional position retains the oldest payload referenced by the just-submitted transition until its completion has captured Self::retained_values. Warm-up clamps the minimum position to zero. The return value is the number of payloads removed.

Source

pub fn retained_values(&self) -> impl Iterator<Item = &P>

Iterates retained payloads in stable coordinate order.

Source

pub fn envelopes(&self) -> impl Iterator<Item = &RealtimePayloadEnvelope<P>>

Iterates retained typed envelopes in stable coordinate order.

Source

pub fn entries(&self) -> impl Iterator<Item = (RealtimeSlotCoordinate, &P)>

Iterates exact coordinates and retained payloads in stable order.

Trait Implementations§

Source§

impl<P: Clone> Clone for RealtimePayloadHistory<P>

Source§

fn clone(&self) -> RealtimePayloadHistory<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug> Debug for RealtimePayloadHistory<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Eq> Eq for RealtimePayloadHistory<P>

Source§

impl<P: PartialEq> PartialEq for RealtimePayloadHistory<P>

Source§

fn eq(&self, other: &RealtimePayloadHistory<P>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<P: PartialEq> StructuralPartialEq for RealtimePayloadHistory<P>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.