Struct π

Source
pub struct π<Head, Tail>(pub Head, pub Tail);
Expand description

The Cons type, a.k.a. π, is used to represent the head of a type-level list, also known as an anonymous product type.

Cons is used together with Nil to produce a type-level list using the Product! macro.

Cons is also shown as π, together with Nil shown as ε, to improve the readability of compiler error messages. Through the shortened name, a product type would take slightly less space, making it more likely to fit on a single line for the user to read what the type is.

§Example

Given the following product type definition:

type MyTypes = Product![u32, String, bool];

The following type would be generated:

type MyTypes = Cons<u32, Cons<String, Cons<bool, Nil>>>;

which would be shown with the shortened representation as:

type MyTypes = π<u32, π<String, π<bool, ε>>>;

Tuple Fields§

§0: Head§1: Tail

Trait Implementations§

Source§

impl<Head: Clone, Tail: Clone> Clone for π<Head, Tail>

Source§

fn clone(&self) -> π<Head, Tail>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Head: Debug, Tail: Debug> Debug for π<Head, Tail>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Head: Default, Tail: Default> Default for π<Head, Tail>

Source§

fn default() -> π<Head, Tail>

Returns the “default value” for a type. Read more
Source§

impl<Head: PartialEq, Tail: PartialEq> PartialEq for π<Head, Tail>

Source§

fn eq(&self, other: &π<Head, Tail>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Head: Eq, Tail: Eq> Eq for π<Head, Tail>

Source§

impl<Head, Tail> StructuralPartialEq for π<Head, Tail>

Auto Trait Implementations§

§

impl<Head, Tail> Freeze for π<Head, Tail>
where Head: Freeze, Tail: Freeze,

§

impl<Head, Tail> RefUnwindSafe for π<Head, Tail>
where Head: RefUnwindSafe, Tail: RefUnwindSafe,

§

impl<Head, Tail> Send for π<Head, Tail>
where Head: Send, Tail: Send,

§

impl<Head, Tail> Sync for π<Head, Tail>
where Head: Sync, Tail: Sync,

§

impl<Head, Tail> Unpin for π<Head, Tail>
where Head: Unpin, Tail: Unpin,

§

impl<Head, Tail> UnwindSafe for π<Head, Tail>
where Head: UnwindSafe, Tail: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.