Skip to main content

HCons

Struct HCons 

Source
pub struct HCons<H, T>(/* private fields */);
Expand description

A cons cell for heterogeneous lists. HCons<H, T> prepends head H to tail T.

§Examples

use reflect_nat::{HNil, HCons, Z, S};
use reify_reflect_core::{Reflect, RuntimeValue};

// A list containing [1, 0] at the type level
type MyList = HCons<S<Z>, HCons<Z, HNil>>;
assert_eq!(
    MyList::reflect(),
    vec![RuntimeValue::Nat(1), RuntimeValue::Nat(0)]
);

Trait Implementations§

Source§

impl<H, T> HList for HCons<H, T>
where T: HList,

Source§

fn len() -> usize

The number of elements in this type-level list.
Source§

fn is_empty() -> bool

Whether this type-level list is empty.
Source§

impl<H, T> Reflect for HCons<H, T>
where H: Reflect<Value = RuntimeValue>, T: Reflect<Value = Vec<RuntimeValue>>,

Source§

type Value = Vec<RuntimeValue>

The runtime representation of this type-level value.
Source§

fn reflect() -> <HCons<H, T> as Reflect>::Value

Produce the runtime value corresponding to this type-level value.

Auto Trait Implementations§

§

impl<H, T> Freeze for HCons<H, T>

§

impl<H, T> RefUnwindSafe for HCons<H, T>

§

impl<H, T> Send for HCons<H, T>
where H: Send, T: Send,

§

impl<H, T> Sync for HCons<H, T>
where H: Sync, T: Sync,

§

impl<H, T> Unpin for HCons<H, T>
where H: Unpin, T: Unpin,

§

impl<H, T> UnsafeUnpin for HCons<H, T>

§

impl<H, T> UnwindSafe for HCons<H, T>
where H: UnwindSafe, T: 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> 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.