pub struct MovingMin<T> { /* private fields */ }
Expand description
let mut moving_min = MovingMin::<i32>::new();
moving_min.push(2);
moving_min.push(1);
moving_min.push(3);
assert_eq!(moving_min.min(), Some(&1));
assert_eq!(moving_min.pop(), Some(2));
assert_eq!(moving_min.min(), Some(&1));
assert_eq!(moving_min.pop(), Some(1));
assert_eq!(moving_min.min(), Some(&3));
assert_eq!(moving_min.pop(), Some(3));
assert_eq!(moving_min.min(), None);
assert_eq!(moving_min.pop(), None);
Creates a new MovingMin
to keep track of the minimum in a sliding
window.
Creates a new MovingMin
to keep track of the minimum in a sliding
window with capacity
allocated slots.
Returns the minimum of the sliding window or None
if the window is
empty.
Pushes a new element into the sliding window.
Removes and returns the last value of the sliding window.
Returns the number of elements stored in the sliding window.
Returns true
if the moving window contains no elements.
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
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.