pub struct Pair<First, Second>(pub First, pub Second);Expand description
Wraps two values.
A simple tuple struct that holds two values of potentially different types.
§Higher-Kinded Type Representation
This type has multiple higher-kinded representations:
PairBrand: fully polymorphic over both values (bifunctor).PairWithFirstBrand<First>: the first value type is fixed, polymorphic over the second (functor over second).PairWithSecondBrand<Second>: the second value type is fixed, polymorphic over the first (functor over first).
§Serialization
This type supports serialization and deserialization via serde when the serde feature is enabled.
First: The type of the first value.Second: The type of the second value.
§Fields
0: The first value.1: The second value.
§Examples
use fp_library::types::*;
let p = Pair(1, "hello");
assert_eq!(p.0, 1);
assert_eq!(p.1, "hello");Tuple Fields§
§0: First§1: SecondTrait Implementations§
Source§impl<'de, First, Second> Deserialize<'de> for Pair<First, Second>where
First: Deserialize<'de>,
Second: Deserialize<'de>,
impl<'de, First, Second> Deserialize<'de> for Pair<First, Second>where
First: Deserialize<'de>,
Second: 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<First: Ord, Second: Ord> Ord for Pair<First, Second>
impl<First: Ord, Second: Ord> Ord for Pair<First, Second>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<First: PartialOrd, Second: PartialOrd> PartialOrd for Pair<First, Second>
impl<First: PartialOrd, Second: PartialOrd> PartialOrd for Pair<First, Second>
impl<First: Copy, Second: Copy> Copy for Pair<First, Second>
impl<First: Eq, Second: Eq> Eq for Pair<First, Second>
impl<First, Second> StructuralPartialEq for Pair<First, Second>
Auto Trait Implementations§
impl<First, Second> Freeze for Pair<First, Second>
impl<First, Second> RefUnwindSafe for Pair<First, Second>where
First: RefUnwindSafe,
Second: RefUnwindSafe,
impl<First, Second> Send for Pair<First, Second>
impl<First, Second> Sync for Pair<First, Second>
impl<First, Second> Unpin for Pair<First, Second>
impl<First, Second> UnwindSafe for Pair<First, Second>where
First: UnwindSafe,
Second: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more