Trait States

Source
pub trait States {
    type Symbol;

    // Required methods
    fn size() -> usize;
    fn pair_idx(cur: usize, next: usize) -> usize;
    fn state(input: Self::Symbol) -> usize;
    fn symbol(state: usize) -> Self::Symbol;
    fn finisher() -> Self::Symbol;

    // Provided method
    fn pair(state: usize, next: usize) -> (Dibit, Dibit) { ... }
}

Required Associated Types§

Source

type Symbol

Symbol type to use for states and input.

Required Methods§

Source

fn size() -> usize

Number of rows/columns in the state machine.

Source

fn pair_idx(cur: usize, next: usize) -> usize

Get the “constellation point” on the transition from the current state to the next state.

Source

fn state(input: Self::Symbol) -> usize

Convert the given symbol to a state.

Source

fn symbol(state: usize) -> Self::Symbol

Convert the given state to a symbol.

Source

fn finisher() -> Self::Symbol

Get the “flushing” symbol fed in at the end of a stream.

Provided Methods§

Source

fn pair(state: usize, next: usize) -> (Dibit, Dibit)

Get the dibit pair on the transition from the current state to the next state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§