Skip to main content

EmptyList

Trait EmptyList 

pub trait EmptyList {
    type PushFirst<U: 'static>: List;
    type RootEmpty: EmptyList;

    // Required methods
    fn push_first<U>(self, item: U) -> Self::PushFirst<U>
       where U: 'static;
    fn root_empty() -> Self::RootEmpty;
}
Expand description

Trait implemented by empty lists to support list construction.

§Examples

use cel_runtime::{EmptyList, List};
let list = <()>::root_empty().push_first(String::from("owned"));
assert_eq!(list.head(), "owned");

Required Associated Types§

type PushFirst<U: 'static>: List

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

type RootEmpty: EmptyList

The canonical empty list type for this family.

Required Methods§

fn push_first<U>(self, item: U) -> Self::PushFirst<U>
where U: 'static,

Moves the first element into a singleton list.

§Examples

See EmptyList.

fn root_empty() -> Self::RootEmpty

Returns a new canonical empty list.

§Examples

See EmptyList.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl EmptyList for ()

§

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

Moves the first field into a singleton tuple list.

§

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

Constructs the empty tuple-list root.

§

type PushFirst<U: 'static> = (U, ())

§

type RootEmpty = ()

Implementors§

§

impl<T> EmptyList for CNil<T>

§

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

§

type RootEmpty = CNil<()>