[][src]Enum kul_core::Datum

pub enum Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
{ Text(TextType), Combination { operator: DatumRef, operands: DatumRef, }, EmptyNest, List { elem: DatumRef, next: DatumRef, }, EmptyList, Extra(ExtraType), }

The abstract syntax tree (AST) type returned by parsing. It is extensible by the ExtraType parameter, and it is parameterized over the DatumRef type used to refer to the other Datums in an AST. It can also be used for DAGs.

Variants

Text(TextType)

A logically unbroken span of text. (Only nest forms break text logically, but escape characters break the representation into chunks.)

Combination

A nest form that is not empty and so has a non-empty "operator"/"head" sub-form and has a possibly-empty "operands" sub-form(s).

Fields of Combination

operator: DatumRef

The operator form, as any Datum variant.

operands: DatumRef

The operands form, as a List or EmptyList or a Text variant.

EmptyNest

An empty nest form

List

A list of other Datums. Used to represent parsed operands.

Fields of List

elem: DatumRef

An element of the list, as any Datum variant.

next: DatumRef

The rest of the list, as a List or EmptyList variant.

EmptyList

An empty list

Extra(ExtraType)

Extensibility that custom macros/combiners may utilize to add additional variants

Trait Implementations

impl<TextType: Debug, ExtraType: Debug, DatumRef: Debug> Debug for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
[src]

impl<TT1, TT2, ET1, ET2, DR1, DR2> PartialEq<Datum<TT2, ET2, DR2>> for Datum<TT1, ET1, DR1> where
    DR1: DerefTryMut<Target = Datum<TT1, ET1, DR1>>,
    DR2: DerefTryMut<Target = Datum<TT2, ET2, DR2>>,
    TT1: PartialEq<TT2>,
    ET1: PartialEq<ET2>, 
[src]

This allows different concrete Datum types to be compared with each other for equality if their "extra" types can be. This also avoids stack overflows for long lists and deep nests (but can still overflow on other deep tree shapes, but those are rare).

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<TextType: Eq, ExtraType: Eq, DatumRef: Eq> Eq for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
[src]

impl<TextType: Hash, ExtraType: Hash, DatumRef: Hash> Hash for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<TextType: Copy, ExtraType: Copy, DatumRef: Copy> Copy for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
[src]

impl<TextType: Clone, ExtraType: Clone, DatumRef: Clone> Clone for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: DerefTryMut<Target = Datum<TextType, ExtraType, DatumRef>>, 
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<TextType, ExtraType, DatumRef> Send for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: Send,
    ExtraType: Send,
    TextType: Send

impl<TextType, ExtraType, DatumRef> Sync for Datum<TextType, ExtraType, DatumRef> where
    DatumRef: Sync,
    ExtraType: Sync,
    TextType: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]