pub struct Identity<A>(pub A);Expand description
Wraps a value.
The Identity type represents a trivial wrapper around a value. It is the simplest possible container.
It is often used as a base case for higher-kinded types or when a container is required but no additional effect is needed.
§Higher-Kinded Type Representation
The higher-kinded representation of this type constructor is IdentityBrand,
which is fully polymorphic over the wrapped value type.
§Serialization
This type supports serialization and deserialization via serde when the serde feature is enabled.
§Type Parameters
A: The type of the wrapped value.
§Fields
0: The wrapped value.
§Examples
use fp_library::types::*;
let x = Identity(5);
assert_eq!(x.0, 5);Tuple Fields§
§0: ATrait Implementations§
Source§impl<'de, A> Deserialize<'de> for Identity<A>where
A: Deserialize<'de>,
impl<'de, A> Deserialize<'de> for Identity<A>where
A: 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<A: Ord> Ord for Identity<A>
impl<A: Ord> Ord for Identity<A>
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<A: PartialOrd> PartialOrd for Identity<A>
impl<A: PartialOrd> PartialOrd for Identity<A>
impl<A: Copy> Copy for Identity<A>
impl<A: Eq> Eq for Identity<A>
impl<A> StructuralPartialEq for Identity<A>
Auto Trait Implementations§
impl<A> Freeze for Identity<A>where
A: Freeze,
impl<A> RefUnwindSafe for Identity<A>where
A: RefUnwindSafe,
impl<A> Send for Identity<A>where
A: Send,
impl<A> Sync for Identity<A>where
A: Sync,
impl<A> Unpin for Identity<A>where
A: Unpin,
impl<A> UnwindSafe for Identity<A>where
A: 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