pub struct First<T>(pub T);Expand description
A no-op merge that retains the first value.
This type provides a merge implementation that does nothing. Merging anything with a value of this type results in the other value getting discarded.
The opposite of this is Last.
§Example
let a = First(vec![0, 1, 2]);
let b = First(vec![3, 4]);
let merged = a.merge(b).unwrap();
assert_eq!(*merged, &[0, 1, 2]);§serde
This type deserializes like T.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T> BorrowMut<T> for First<T>
impl<T> BorrowMut<T> for First<T>
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<'de, T> Deserialize<'de> for First<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for First<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Ord> Ord for First<T>
impl<T: Ord> Ord for First<T>
Source§impl<T: PartialOrd> PartialOrd for First<T>
impl<T: PartialOrd> PartialOrd for First<T>
impl<T: Copy> Copy for First<T>
impl<T: Eq> Eq for First<T>
impl<T> StructuralPartialEq for First<T>
Auto Trait Implementations§
impl<T> Freeze for First<T>where
T: Freeze,
impl<T> RefUnwindSafe for First<T>where
T: RefUnwindSafe,
impl<T> Send for First<T>where
T: Send,
impl<T> Sync for First<T>where
T: Sync,
impl<T> Unpin for First<T>where
T: Unpin,
impl<T> UnwindSafe for First<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