Skip to main content

SnapshotRing

Struct SnapshotRing 

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

A bounded ring of ArenaSnapshots: “current” (the most recently pushed entry, ring index 0) plus up to depth older entries. Never retains more than depth + 1 entries, no matter how many times Self::push is called – the “a design with no $past retention need pays no retention cost beyond entry 0” guard (see snapshot_ring_depth_0_design_allocates_no_ring below). Whether a ring is allocated at all for a given instance is a decision this type does not make – sched::control::Engine only ever constructs one when the design has at least one assertion/clocking-block/$past site to begin with (§1.4’s “not every instance, to avoid taxing designs with no SVA at all”); a design with none never calls Self::new and pays nothing.

Implementations§

Source§

impl SnapshotRing

Source

pub fn new(depth: usize) -> Self

depth = N (16.9.3/16.9.4’s largest literal number_of_ticks argument across the whole design that needs this ring; 0 if $past/$past_gclk is never called with a nonzero tick count for it). Allocates nothing up front (VecDeque::new(), never with_capacity) – the first Self::push call is this ring’s first real allocation.

Source

pub fn depth(&self) -> usize

N as passed to Self::new – how many entries beyond “current” this ring retains.

Source

pub fn len(&self) -> usize

How many entries are currently retained (<= depth + 1) – a test/ diagnostic accessor; Self::push/Self::get already enforce the bound internally without consulting this.

Source

pub fn is_empty(&self) -> bool

true before the first Self::push (clippy’s len_without_is_empty).

Source

pub fn push(&mut self, snap: ArenaSnapshot)

Appends snap as the new “current” entry, evicting the oldest entry once the ring already holds depth + 1 entries – never grows past that bound no matter how many times this is called.

Source

pub fn get(&self, ticks_back: usize) -> Option<&ArenaSnapshot>

The entry ticks_back pushes before the most recent one (0 = “current”, the value Self::push most recently stored). None when ticks_back exceeds how many entries are actually retained – either because the ring hasn’t been pushed to that many times yet (simulation start; 16.9.3’s own “before the Nth previous clock tick, treat the value as X” case, left to the $past lowering task to turn into the right X-valued result) or because ticks_back > depth (a caller bug this primitive reports rather than panics on – unlike RegionQueues’s “this region can never be serviced at all” structural impossibility, this is a plain out-of-range read).

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> 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, 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.
Source§

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

Source§

fn vzip(self) -> V