Trait Alphabet

Source
pub trait Alphabet {
    type Elem;

    // Required methods
    fn as_slice(&self) -> &[Self::Elem];
    fn as_mut_slice(&mut self) -> &mut [Self::Elem];
    fn to_vec(&self) -> Vec<Self::Elem>;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn len(&self) -> usize { ... }
}
Expand description

Alphabet describes a finite set of symbols used to construct a formal language.

Ideally, the alphabet should be implemented on unit enums since each symbol can be represented as a unique variant and assigned a particular value. The values of the variants may then be used as pointers, specifiying the location of the symbol w.r.t. the alphabet.

Required Associated Types§

Required Methods§

Source

fn as_slice(&self) -> &[Self::Elem]

Source

fn as_mut_slice(&mut self) -> &mut [Self::Elem]

Source

fn to_vec(&self) -> Vec<Self::Elem>

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn len(&self) -> usize

Implementations on Foreign Types§

Source§

impl<S: Symbolic> Alphabet for [S]

Source§

type Elem = S

Source§

fn as_slice(&self) -> &[S]

Source§

fn as_mut_slice(&mut self) -> &mut [S]

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn to_vec(&self) -> Vec<S>

Source§

impl<S: Symbolic> Alphabet for Vec<S>

Source§

type Elem = S

Source§

fn as_slice(&self) -> &[S]

Source§

fn as_mut_slice(&mut self) -> &mut [S]

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn to_vec(&self) -> Vec<S>

Implementors§