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>
impl<P> RealtimePayloadHistory<P>
Sourcepub fn new(schedule: RealtimeSpeechConfig) -> Self
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.
Sourcepub fn with_contract(contract: RealtimePayloadContract) -> Self
pub fn with_contract(contract: RealtimePayloadContract) -> Self
Creates an empty history bound to one complete payload contract.
Sourcepub const fn schedule(&self) -> &RealtimeSpeechConfig
pub const fn schedule(&self) -> &RealtimeSpeechConfig
Returns the exact normalized schedule bound to this history.
Sourcepub const fn contract(&self) -> Option<&RealtimePayloadContract>
pub const fn contract(&self) -> Option<&RealtimePayloadContract>
Returns the exact payload contract after first-frame binding.
Sourcepub fn bind_or_validate_contract(
&mut self,
contract: &RealtimePayloadContract,
) -> Result<(), RealtimePayloadHistoryError>
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.
Sourcepub fn validate_successor(
&self,
successor: &Self,
) -> Result<(), RealtimePayloadHistoryError>
pub fn validate_successor( &self, successor: &Self, ) -> Result<(), RealtimePayloadHistoryError>
Validates whether a branch history may replace this canonical history.
Sourcepub fn validate_schedule(
&self,
schedule: &RealtimeSpeechConfig,
) -> Result<(), RealtimePayloadHistoryError>
pub fn validate_schedule( &self, schedule: &RealtimeSpeechConfig, ) -> Result<(), RealtimePayloadHistoryError>
Rejects handoff to any materially different normalized schedule.
Sourcepub fn delayed_coordinate(
&self,
schedule: &RealtimeSpeechConfig,
base_position: usize,
slot: RealtimeFrameSlot,
) -> Result<RealtimeSlotCoordinate, RealtimePayloadHistoryError>
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.
Sourcepub fn insert(
&mut self,
schedule: &RealtimeSpeechConfig,
coordinate: RealtimeSlotCoordinate,
payload: P,
) -> Result<(), RealtimePayloadHistoryError>
pub fn insert( &mut self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, payload: P, ) -> Result<(), RealtimePayloadHistoryError>
Inserts one payload at one exact validated coordinate.
Sourcepub fn insert_delayed(
&mut self,
schedule: &RealtimeSpeechConfig,
base_position: usize,
slot: RealtimeFrameSlot,
payload: P,
) -> Result<RealtimeSlotCoordinate, RealtimePayloadHistoryError>
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.
Sourcepub fn insert_many(
&mut self,
schedule: &RealtimeSpeechConfig,
payloads: impl IntoIterator<Item = (RealtimeSlotCoordinate, P)>,
) -> Result<(), RealtimePayloadHistoryError>
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.
Sourcepub fn overwrite_many(
&mut self,
schedule: &RealtimeSpeechConfig,
payloads: impl IntoIterator<Item = (RealtimeSlotCoordinate, P)>,
) -> Result<(), RealtimePayloadHistoryError>
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.
Sourcepub fn get(
&self,
schedule: &RealtimeSpeechConfig,
coordinate: RealtimeSlotCoordinate,
) -> Result<Option<&P>, RealtimePayloadHistoryError>
pub fn get( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<Option<&P>, RealtimePayloadHistoryError>
Returns a payload at one exact validated coordinate, when present.
Sourcepub fn envelope(
&self,
schedule: &RealtimeSpeechConfig,
coordinate: RealtimeSlotCoordinate,
) -> Result<Option<&RealtimePayloadEnvelope<P>>, RealtimePayloadHistoryError>
pub fn envelope( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<Option<&RealtimePayloadEnvelope<P>>, RealtimePayloadHistoryError>
Returns the typed envelope at one exact validated coordinate, when present.
Sourcepub fn required(
&self,
schedule: &RealtimeSpeechConfig,
coordinate: RealtimeSlotCoordinate,
) -> Result<&P, RealtimePayloadHistoryError>
pub fn required( &self, schedule: &RealtimeSpeechConfig, coordinate: RealtimeSlotCoordinate, ) -> Result<&P, RealtimePayloadHistoryError>
Resolves one required payload or fails with its exact missing coordinate.
Sourcepub fn resolve_required(
&self,
schedule: &RealtimeSpeechConfig,
coordinates: impl IntoIterator<Item = RealtimeSlotCoordinate>,
) -> Result<Vec<&P>, RealtimePayloadHistoryError>
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.
Sourcepub fn prune_for_next_frontier(
&mut self,
schedule: &RealtimeSpeechConfig,
next_frontier: usize,
) -> Result<usize, RealtimePayloadHistoryError>
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.
Sourcepub fn retained_values(&self) -> impl Iterator<Item = &P>
pub fn retained_values(&self) -> impl Iterator<Item = &P>
Iterates retained payloads in stable coordinate order.
Sourcepub fn envelopes(&self) -> impl Iterator<Item = &RealtimePayloadEnvelope<P>>
pub fn envelopes(&self) -> impl Iterator<Item = &RealtimePayloadEnvelope<P>>
Iterates retained typed envelopes in stable coordinate order.
Sourcepub fn entries(&self) -> impl Iterator<Item = (RealtimeSlotCoordinate, &P)>
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>
impl<P: Clone> Clone for RealtimePayloadHistory<P>
Source§fn clone(&self) -> RealtimePayloadHistory<P>
fn clone(&self) -> RealtimePayloadHistory<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more