Struct egui::util::History[][src]

pub struct History<T> { /* fields omitted */ }
Expand description

This struct tracks recent values of some time series.

One use is to show a log of recent events, or show a graph over recent events.

It has both a maximum length and a maximum storage time. Elements are dropped when either max length or max age is reached.

Time difference between values can be zero, but never negative.

This can be used for things like smoothed averages (for e.g. FPS) or for smoothed velocity (e.g. mouse pointer speed). All times are in seconds.

Implementations

Current number of values kept in history

Total number of values seen. Includes those that have been discarded due to max_len or max_age.

Amount of time contained from start to end in this History.

(time, value) pairs Time difference between values can be zero, but never negative.

Values must be added with a monotonically increasing time, or at least not decreasing.

Mean time difference between values in this History.

Remove samples that are too old

Calculate a smooth velocity (per second) over the entire time span

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.