[−][src]Struct sliding_window::SlidingWindow
A sliding window.
Sliding windows are queues that overwrite their oldest data when full.
Implementations
impl<IT, N> SlidingWindow<IT, N> where
N: Size<IT>,
[src]
N: Size<IT>,
pub fn new() -> Self
[src]
Returns an empty sliding window object.
pub fn insert(&mut self, t: IT) -> Option<IT>
[src]
Insert an element into the window.
If the window is full, this method will remove and return the oldest element.
pub fn clear(&mut self)
[src]
Removes all elements from the window.
pub fn is_full(&self) -> bool
[src]
Returns true
if the window is full.
pub fn count(&self) -> usize
[src]
Returns the number of elements stored in the window.
pub fn iter(&self) -> Iter<IT, N>
[src]
Returns an iterator to read from the window.
The iterator starts at the oldest element and ends with the newest.
pub fn iter_unordered(&self) -> UnorderedIter<IT, N>
[src]
Returns an iterator to read from the window.
This iterator starts at the beginning of the internal array instead of the oldest element so it does not return the elements in the order of insertion.
Trait Implementations
impl<IT, N> Default for SlidingWindow<IT, N> where
N: Size<IT>,
[src]
N: Size<IT>,
impl<IT, N> Index<usize> for SlidingWindow<IT, N> where
N: Size<IT>,
[src]
N: Size<IT>,
Auto Trait Implementations
impl<IT, N> Send for SlidingWindow<IT, N> where
IT: Send,
IT: Send,
impl<IT, N> Sync for SlidingWindow<IT, N> where
IT: Sync,
IT: Sync,
impl<IT, N> Unpin for SlidingWindow<IT, N> where
<N as ArrayLength<MaybeUninit<IT>>>::ArrayType: Unpin,
<N as ArrayLength<MaybeUninit<IT>>>::ArrayType: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,