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

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

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

The padding must be an ascii.

The check pad() < 128 failed.

The padding must not be a symbol.

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

Symbols must be ascii.

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

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.

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.

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 Clone for ValidError
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for ValidError
[src]

impl Debug for ValidError
[src]

Formats the value using the given formatter.

impl PartialEq for ValidError
[src]

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

This method tests for !=.

impl Eq for ValidError
[src]

impl Display for ValidError
[src]

Formats the value using the given formatter.

impl Error for ValidError
[src]

A short description of the error. Read more

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