Skip to main content

HistoryView

Struct HistoryView 

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

The Time Lens cursor over a ring (§2.1).

Holds no reference to the ring, so it can live in application state next to one and be copied freely. Every method takes the ring it should be resolved against.

Implementations§

Source§

impl HistoryView

Source

pub const fn live() -> Self

A view following the newest sample.

Source

pub const fn position(self) -> HistoryPosition

Where the cursor is.

Source

pub const fn is_live(self) -> bool

Whether the view is following live data.

Source

pub const fn allows_process_actions(self) -> bool

Whether process-control actions may be offered.

§2.1 and §15.1 both require process actions to be disabled while inspecting history: the process shown may not exist any more, and its PID may since have been reused. Encoding the rule here keeps every call site from having to remember it.

Source

pub const fn return_live(&mut self)

Returns to live, the single explicit action §2.1 specifies for L.

Source

pub fn selected_absolute(self, ring: &HistoryRing) -> Option<u64>

The absolute index the cursor resolves to, clamped into what is retained.

Constant time. A selection whose sample has since been evicted resolves to the oldest retained sample rather than to nothing, so the panel does not blank out while the user is reading it.

Source

pub fn selected(self, ring: &HistoryRing) -> Option<&HistoricalSample>

The selected sample, or the newest one when live.

Source

pub fn step_back(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome

Moves steps samples towards the past ([, or Shift+[ with HISTORY_STEP_MULTIPLIER).

Source

pub fn step_forward(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome

Moves steps samples towards the present (], or Shift+]).

Source

pub fn seek_to_offset( &mut self, ring: &HistoryRing, offset: Duration, ) -> SeekOutcome

Selects the newest sample at least offset behind the newest one.

Effectively constant time: sample offsets increase monotonically, so this is a binary search rather than a scan (§21 M4). An offset reaching past the oldest retained sample clamps there and says so.

Source

pub fn offset_from_live(self, ring: &HistoryRing) -> Duration

How far behind live the selected sample is.

Computed from monotonic offsets, so a wall-clock change cannot make the header count backwards (§8.1). Zero when live.

Source

pub fn format_offset(self, ring: &HistoryRing) -> String

The header offset text: LIVE, or -00:37 (§2.1, §5.6).

Reports the offset only. §2.1’s third header state, PAUSED, is a UI state — a paused view that has not been scrubbed sits at offset zero — and is distinguished with Self::is_live.

Source

pub fn compare( self, ring: &HistoryRing, metric: HistoryMetric, baseline: ComparisonBaseline, ) -> Option<MetricComparison>

Compares the selected sample’s metric against an earlier sample (§2.5).

Returns None, never a zero delta, when the baseline does not exist or when either sample’s input was unavailable. That is what stops a counter reset from being rendered as a spike (§21 M4) and what honours §26’s “unavailable is not zero”.

Source

pub fn comparisons( self, ring: &HistoryRing, metric: HistoryMetric, ) -> MetricComparisons

Both comparisons §2.5 requires, in one call.

Trait Implementations§

Source§

impl Clone for HistoryView

Source§

fn clone(&self) -> HistoryView

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 Copy for HistoryView

Source§

impl Debug for HistoryView

Source§

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

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

impl Default for HistoryView

Source§

fn default() -> HistoryView

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

impl Eq for HistoryView

Source§

impl Hash for HistoryView

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for HistoryView

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HistoryView

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.