pub struct Pair<A, B> {
pub fst: A,
pub snd: B,
}Expand description
A generic ordered pair.
This is the Rust meta-level analogue of Prod in Lean 4.
Fields§
§fst: AFirst component.
snd: BSecond component.
Implementations§
Source§impl<A, B> Pair<A, B>
impl<A, B> Pair<A, B>
Sourcepub fn from_tuple((a, b): (A, B)) -> Self
pub fn from_tuple((a, b): (A, B)) -> Self
Construct from a Rust tuple.
Sourcepub fn into_tuple(self) -> (A, B)
pub fn into_tuple(self) -> (A, B)
Convert to a Rust tuple.
Sourcepub fn bimap<C, D>(
self,
f: impl FnOnce(A) -> C,
g: impl FnOnce(B) -> D,
) -> Pair<C, D>
pub fn bimap<C, D>( self, f: impl FnOnce(A) -> C, g: impl FnOnce(B) -> D, ) -> Pair<C, D>
Map both components.
Trait Implementations§
impl<A: Eq, B: Eq> Eq for Pair<A, B>
impl<A, B> StructuralPartialEq for Pair<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Pair<A, B>
impl<A, B> RefUnwindSafe for Pair<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Pair<A, B>
impl<A, B> Sync for Pair<A, B>
impl<A, B> Unpin for Pair<A, B>
impl<A, B> UnsafeUnpin for Pair<A, B>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for Pair<A, B>where
A: UnwindSafe,
B: 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