pub struct Last<T>(pub Option<T>);
Expand description
A semigroup over Option by returning the last value available.
let five = Last::from(5);
let no_value = Last(None);
let ten = Last::from(10);
assert_eq!(Last::from(5), ten.combine(five));
assert_eq!(Last::from(10), ten.combine(no_value));
assert_eq!(Last(None), no_value.combine(no_value));
Tuple Fields§
§0: Option<T>
Trait Implementations§
Source§impl<T: Ord> Ord for Last<T>
impl<T: Ord> Ord for Last<T>
Source§impl<T: PartialOrd> PartialOrd for Last<T>
impl<T: PartialOrd> PartialOrd for Last<T>
impl<T: Copy> Copy for Last<T>
impl<T: Eq> Eq for Last<T>
impl<T> StructuralPartialEq for Last<T>
Auto Trait Implementations§
impl<T> Freeze for Last<T>where
T: Freeze,
impl<T> RefUnwindSafe for Last<T>where
T: RefUnwindSafe,
impl<T> Send for Last<T>where
T: Send,
impl<T> Sync for Last<T>where
T: Sync,
impl<T> Unpin for Last<T>where
T: Unpin,
impl<T> UnwindSafe for Last<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