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);
Implementations§
source§impl<T: Clone + PartialOrd> MovingMin<T>
impl<T: Clone + PartialOrd> MovingMin<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for MovingMin<T>where T: RefUnwindSafe,
impl<T> Send for MovingMin<T>where T: Send,
impl<T> Sync for MovingMin<T>where T: Sync,
impl<T> Unpin for MovingMin<T>where T: Unpin,
impl<T> UnwindSafe for MovingMin<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