Skip to main content

EmptyList

Trait EmptyList 

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

    // Required methods
    fn push_first<U: 'static>(self, item: U) -> Self::PushFirst<U>;
    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§

Source

type PushFirst<U: 'static>: List

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

Source

type RootEmpty: EmptyList

The canonical empty list type for this family.

Required Methods§

Source

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

Moves the first element into a singleton list.

§Examples

See EmptyList.

Source

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§

Source§

impl EmptyList for ()

Source§

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

Moves the first field into a singleton tuple list.

Source§

fn root_empty() -> Self::RootEmpty

Constructs the empty tuple-list root.

Source§

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

Source§

type RootEmpty = ()

Implementors§