Skip to main content

CNil

Struct CNil 

pub struct CNil<T>(/* private fields */)
where
    T: CStackListHeadLimit;
Expand description

Empty repr(C) list used as the tail sentinel for CStackList.

The hidden backing tail preserves prefix-view layout but contributes no logical fields. Construct an owning empty root through EmptyList::root_empty.

§Examples

use cel_runtime::{CNil, EmptyList, IntoCStackList, IntoRustTuple, List};
let empty = CNil::<()>::root_empty();
assert!(empty.is_empty());
assert_eq!(empty.push_first("first").into_rust_tuple(), ("first",));
assert_eq!(().into_c_stack_list().len(), 0);

Trait Implementations§

§

impl<T> CStackListHeadLimit for CNil<T>

§

const HEAD_LIMIT: usize = T::HEAD_LIMIT

The offset to the end of the head element. Read more
§

impl<T> Clone for CNil<T>

§

fn clone(&self) -> CNil<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
§

impl<T> Debug for CNil<T>

§

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

Formats the empty list as an empty tuple.

§Errors

Returns a destination formatting error.

§

impl<T> EmptyList for CNil<T>

§

fn push_first<U>(self, item: U) -> <CNil<T> as EmptyList>::PushFirst<U>
where U: 'static,

Moves a first field into a node backed by this empty sentinel.

§

fn root_empty() -> <CNil<T> as EmptyList>::RootEmpty

Constructs the empty canonical root without backing fields.

§

type PushFirst<U: 'static> = CStackList<U, CNil<T>>

The result of pushing the first element onto an empty list.
§

type RootEmpty = CNil<()>

The canonical empty list type for this family.
§

impl IntoRustTuple for CNil<()>

§

fn into_rust_tuple(self) -> <CNil<()> as IntoRustTuple>::Tuple

Consumes the canonical empty list and returns the empty tuple.

§

type Tuple = ()

The native tuple type with fields in logical source order.
§

impl<T, P> ListTypeIteratorAdvance<P> for CNil<T>

§

fn advancer<R>( _iter: &mut ListTypeIterator<R, P>, ) -> Option<<P as ListTypeProperty>::Output>
where R: List,

Reports exhaustion without generating a property for the backing tail.

§

impl<T, O> PartialEq<O> for CNil<T>
where T: List + CStackListHeadLimit, O: List,

§

fn eq(&self, other: &O) -> bool

Returns whether the other logical list is also empty.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
§

impl StackResult for CNil<()>

§

unsafe fn take_result(_stack: &mut RawStack) -> Undefined

Returns the empty-stack marker without reading a nonexistent slot.

§

impl ToTypeIdList for CNil<()>

§

fn to_stack_info_list() -> Vec<StackInfo>

Returns an empty preloaded stack.

Auto Trait Implementations§

§

impl<T> Freeze for CNil<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for CNil<T>
where T: RefUnwindSafe,

§

impl<T> Send for CNil<T>
where T: Send,

§

impl<T> Sync for CNil<T>
where T: Sync,

§

impl<T> Unpin for CNil<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for CNil<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for CNil<T>
where 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> 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.

§

impl<T> List for T
where T: EmptyList,

§

fn empty() -> <T as List>::Empty

Constructs this family’s canonical empty root.

§

fn head(&self) -> &<T as List>::Head

Borrows a logical head.

  • Precondition: The list is nonempty.
§

fn tail(&self) -> &<T as List>::Tail

Borrows the remaining logical fields.

  • Precondition: The list is nonempty.
§

fn push<U>(self, item: U) -> <T as List>::Push<U>

Moves the first logical field into this empty list.

§

fn append<U>(self, other: U) -> <T as List>::Append<U>
where U: List,

Returns other because this list contributes no logical fields.

§

fn reverse_onto<U>(self, other: U) -> <T as List>::ReverseOnto<U>
where U: List,

Returns other because reversing the empty list adds no fields.

§

const LENGTH: usize = 0

The length of the list, computed at compile time.
§

type Empty = <T as EmptyList>::RootEmpty

The type returned by List::empty().
§

type Head = Undefined

The type of head.
§

type Tail = T

The type of the rest of the list.
§

type Push<U: 'static> = <T as EmptyList>::PushFirst<U>

The type of the list after pushing a new value.
§

type Append<U: List> = U

The style of List appended to Self
§

type ReverseOnto<U: List> = U

The resulting list when reversing Self onto U.
§

fn is_empty(&self) -> bool

Returns true if the list is empty. Read more
§

fn len(&self) -> usize

Returns the length of the list. Read more
§

fn reverse(self) -> Self::ReverseOnto<Self::Empty>
where Self: Sized,

Moves this list’s fields into opposite source order. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.