pub struct EventRing { /* private fields */ }Expand description
Bounded FIFO of ring items.
Implementations§
Source§impl EventRing
impl EventRing
pub fn new() -> Self
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Build a ring with a specific capacity. cap == 0 is
accepted and produces a drop-everything ring (tests may
use this to confirm the bound is enforced at zero too);
production callers should use DEFAULT_CAPACITY.
Sourcepub fn push_event(&mut self, event: EngineEvent)
pub fn push_event(&mut self, event: EngineEvent)
Append a typed engine event. Drops the oldest item when
at capacity so the push is O(1) and never allocates past
cap.
Sourcepub fn push_event_at(&mut self, event: EngineEvent, ts: DateTime<Utc>)
pub fn push_event_at(&mut self, event: EngineEvent, ts: DateTime<Utc>)
Like Self::push_event with an explicit timestamp.
Exists so snapshot tests can drive deterministic content
for variants (Status, Positions, Risk, Regime)
that do not carry a ts inside their typed payload. Never
called by the runtime event loop — production writes
always go through Self::push_event which takes the
wall clock.
Sourcepub fn push_lagged(&mut self, skipped: u64)
pub fn push_lagged(&mut self, skipped: u64)
Append a “broadcast channel lagged” marker. Reserved for
the event loop’s RecvError::Lagged branch.
Sourcepub fn push_lagged_at(&mut self, skipped: u64, ts: DateTime<Utc>)
pub fn push_lagged_at(&mut self, skipped: u64, ts: DateTime<Utc>)
Deterministic sibling of Self::push_lagged for tests.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = &RingItem>
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &RingItem>
Iterate newest-last (i.e. chronological order). Kept
generic so callers can chain .rev() for newest-first
rendering without paying for a materialized Vec.
Sourcepub fn tail(&self, n: usize) -> impl DoubleEndedIterator<Item = &RingItem>
pub fn tail(&self, n: usize) -> impl DoubleEndedIterator<Item = &RingItem>
Iterate the last n items in chronological order. When
n exceeds Self::len the iterator yields every item
— same as Self::iter. Used by the pane to render
“last N rows” without allocating.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventRing
impl RefUnwindSafe for EventRing
impl Send for EventRing
impl Sync for EventRing
impl Unpin for EventRing
impl UnsafeUnpin for EventRing
impl UnwindSafe for EventRing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more