pub struct Cons<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: TailTrait Implementations§
impl<Head, Tail> Eq for π<Head, Tail>
impl<Head, Tail> StructuralPartialEq for π<Head, Tail>
Auto Trait Implementations§
impl<Head, Tail> Freeze for π<Head, Tail>
impl<Head, Tail> RefUnwindSafe for π<Head, Tail>where
Head: RefUnwindSafe,
Tail: RefUnwindSafe,
impl<Head, Tail> Send for π<Head, Tail>
impl<Head, Tail> Sync for π<Head, Tail>
impl<Head, Tail> Unpin for π<Head, Tail>
impl<Head, Tail> UnwindSafe for π<Head, Tail>where
Head: UnwindSafe,
Tail: 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