pub struct MovingMax<T> { /* private fields */ }
Expand description
let mut moving_max = MovingMax::<i32>::new();
moving_max.push(2);
moving_max.push(3);
moving_max.push(1);
assert_eq!(moving_max.max(), Some(&3));
assert_eq!(moving_max.pop(), Some(2));
assert_eq!(moving_max.max(), Some(&3));
assert_eq!(moving_max.pop(), Some(3));
assert_eq!(moving_max.max(), Some(&1));
assert_eq!(moving_max.pop(), Some(1));
assert_eq!(moving_max.max(), None);
assert_eq!(moving_max.pop(), None);
Implementations§
source§impl<T: Clone + PartialOrd> MovingMax<T>
impl<T: Clone + PartialOrd> MovingMax<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for MovingMax<T>where T: RefUnwindSafe,
impl<T> Send for MovingMax<T>where T: Send,
impl<T> Sync for MovingMax<T>where T: Sync,
impl<T> Unpin for MovingMax<T>where T: Unpin,
impl<T> UnwindSafe for MovingMax<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more