pub struct RingBuffer<T> {
    data: VecDeque<T>,
    offset: usize,
}
Expand description

A view onto a finite range of an infinitely long sequence of T.

The Ts are indexed 0..infinity. A RingBuffer begins as a view of elements 0..0 (i.e. nothing). The user of the RingBuffer advances its left and right position independently, although only in the positive direction, and only with left <= right at all times.

Holding a RingBuffer whose view is elements left..right gives the ability to use Index and IndexMut to access elements i in the infinitely long queue for which left <= i < right.

Fields

data: VecDeque<T>offset: usize

Implementations

Trait Implementations

The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
Performs the mutable indexing (container[index]) operation. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes