Enum data_encoding::base::ValidError [] [src]

pub enum ValidError {
    BadBit,
    PadNotAscii,
    PadSymbol,
    SymNotAscii(u8),
    NotValue(u8),
    NotInj(u8),
    NotSurj,
}

Validity errors.

This enum defines the invariants of the Base trait and is returned by the valid function when a constraint check fails.

Variants

BadBit

The base must be a power of two between 2 and 64 inclusive.

The check 1 <= bit() && bit() <= 6 failed.

PadNotAscii

The padding must be an ascii.

The check pad() < 128 failed.

PadSymbol

The padding must not be a symbol.

The check val(pad()) == None failed.

SymNotAscii(u8)

Symbols must be ascii.

The check val(s) == None || s < 128 failed. In other words, s is a symbol and s is not ascii.

NotValue(u8)

Symbols must be mapped to values.

The check that if val(s) == Some(v) then v < 1 << bit() failed. In other words, s is associated to v, but v is not a value.

NotInj(u8)

Symbols must be uniquely mapped.

The check that if val(s) == Some(v) then sym(v) == s failed. In other words, s has value v but v is not associated to symbol s. The val function must be injective on symbols. This is checked using sym because it is the inverse of val on symbols.

NotSurj

Symbols must be mapped to all values.

The check card(val) == 1 << bit() failed. The card function returns the number of inputs for which its argument does not return None. In other words, the number of symbols is not equal to the number of values. The val function must be surjective on symbols to values.

Trait Implementations

impl Eq for ValidError
[src]

impl PartialEq for ValidError
[src]

fn eq(&self, __arg_0: &ValidError) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &ValidError) -> bool

This method tests for !=.

impl Debug for ValidError
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for ValidError
[src]

impl Clone for ValidError
[src]

fn clone(&self) -> ValidError

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Display for ValidError
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Error for ValidError
[src]

fn description(&self) -> &str

A short description of the error. Read more

fn cause(&self) -> Option<&Error>
1.0.0

The lower-level cause of this error, if any. Read more