Struct history_buffer::HistoryBuffer[][src]

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

A “history buffer”, similar to a write-only ring buffer of fixed length.

This buffer keeps a fixed number of elements. On write, the oldest element is overwritten. Thus, the buffer is useful to keep a history of values with some desired depth.

Implementations

Create a new buffer with a specified max depth.

Checks if the buffer is empty.

Checks if the buffer is full, i.e. it has reached capacity.

The maximum number of elements the buffer can hold.

The number of elements currently in the buffer.

Clear all values in the buffer.

Get the most recent value written to the buffer.

Write a new value into the buffer, if it overwrites an old value it is returned.

How long was it since the last measurement.

Get the entire buffer as unsorted.

Get the entire in chronological order, starting with the oldest element.

Trait Implementations

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