Struct data_encoding::base::Opt [] [src]

pub struct Opt<T> {
    pub val: &'static [u8],
    pub sym: &'static [u8],
    pub bit: u8,
    pub pad: u8,
    pub _phantom: PhantomData<T>,
}

Optimized implementation.

This implementation uses static arrays for constant-time lookup. It also uses a phantom type to enable static dispatch on demand.

Fields

val: &'static [u8]

Symbol to value association.

This array must have size 256 and defines val(s) as Some(val[s]) if val[s] < 128 and None otherwise.

sym: &'static [u8]

Value to symbol association.

This array must have size 1 << b and defines sym(v) as sym[v].

bit: u8

The power of two of the base.

This value defines bit() as bit.

pad: u8

The padding.

This value defines pad() as pad.

_phantom: PhantomData<T>

Trait Implementations

impl<T> Base for Opt<T>
[src]

fn bit(&self) -> usize

Returns the power of two of the base.

fn pad(&self) -> u8

Returns the padding.

fn val(&self, x: u8) -> Option<u8>

Returns the value of a symbol. Read more

fn sym(&self, x: u8) -> u8

Returns the symbol of a value. Read more