Skip to main content

EventSeqTracker

Struct EventSeqTracker 

Source
pub struct EventSeqTracker<const N: usize> { /* private fields */ }
Expand description

The last seq accepted on each event channel of one session, and the loss each new occurrence reveals (ridl §3.1; frame specification §5.2 and §7).

The sequence counter of an event is per channel, per provider instance, and starts over with each session (frame specification §3, §7). A channel is one (InterfaceNo, Ordinal) in the session’s catalog, so the tracker keys on that pair and never on the interface alone: two channels of one interface whose occurrences interleave are not a loss. One tracker serves one session, and so one provider instance; a consumer holding several sessions holds one tracker for each, and a new session starts with a new tracker.

The storage is the caller’s: N slots, one per channel, held inline with no allocation. A channel that finds no free slot is refused with TrackerFull; forget frees a slot, for example when the consumer unsubscribes (frame specification §6.2).

Feed the tracker every occurrence the channel accepts, in the order received. A loss is a gap between two accepted occurrences of one channel (frame specification §5.2, §7, which attribute it to ridl §3.1).

Implementations§

Source§

impl<const N: usize> EventSeqTracker<N>

Source

pub const fn new() -> Self

A tracker holding no channel.

Source

pub fn observe( &mut self, interface: InterfaceNo, ordinal: Ordinal, seq: u64, ) -> Result<Continuity, TrackerFull>

Records seq as the latest occurrence on the channel (interface, ordinal) and reports what it reveals.

The first occurrence on a channel takes a free slot and reports Continuity::First. A later one reports Continuity::Next or Continuity::Lost and becomes the channel’s last seq, or reports Continuity::NotNewer and leaves the last seq as it was.

§Errors

TrackerFull when the channel is not tracked and no slot is free. Every tracked channel is unchanged.

Source

pub fn forget(&mut self, interface: InterfaceNo, ordinal: Ordinal)

Stops tracking the channel (interface, ordinal) and frees its slot. The next occurrence on that channel reports Continuity::First. A channel the tracker does not hold is left alone.

Trait Implementations§

Source§

impl<const N: usize> Clone for EventSeqTracker<N>

Source§

fn clone(&self) -> Self

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<const N: usize> Copy for EventSeqTracker<N>

Source§

impl<const N: usize> Debug for EventSeqTracker<N>

Source§

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

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

impl<const N: usize> Default for EventSeqTracker<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Eq for EventSeqTracker<N>

Source§

impl<const N: usize> PartialEq for EventSeqTracker<N>

Source§

fn eq(&self, other: &Self) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<const N: usize> StructuralPartialEq for EventSeqTracker<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for EventSeqTracker<N>
where [Option<Channel>; N]: Freeze,

§

impl<const N: usize> RefUnwindSafe for EventSeqTracker<N>
where [Option<Channel>; N]: RefUnwindSafe,

§

impl<const N: usize> Send for EventSeqTracker<N>
where [Option<Channel>; N]: Send,

§

impl<const N: usize> Sync for EventSeqTracker<N>
where [Option<Channel>; N]: Sync,

§

impl<const N: usize> Unpin for EventSeqTracker<N>
where [Option<Channel>; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for EventSeqTracker<N>
where [Option<Channel>; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for EventSeqTracker<N>
where [Option<Channel>; N]: UnwindSafe,

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