Enum strict_encoding::test_helpers::EnumEncodingTestFailure[][src]

pub enum EnumEncodingTestFailure<T> where
    T: Clone + PartialEq + Debug
{ EncoderFailure(T, Error), DecoderFailure(T, Error, Vec<u8>), DecodedDiffersFromOriginal { original: T, decoded: T, }, ValueMismatch { enum_name: &'static str, variant_name: &'static str, expected: usize, actual: usize, }, EncodedValueMismatch { enum_name: &'static str, variant_name: &'static str, expected: Vec<u8>, actual: Vec<u8>, }, DecoderWrongErrorOnUnknownValue(u8, Error), UnknownDecodesToVariant(u8, T), FailedEq(T), FailedNe(T, T), FailedOrd(T, T), }
Expand description

Failures happening during strict encoding tests of enum encodings.

NB: These errors are specific for testing configuration and should not be used in non-test environment.

Variants

EncoderFailure

Failure during encoding enum variant

Tuple Fields of EncoderFailure

0: T1: Error
DecoderFailure

Failure during decoding binary representation of enum variant

Tuple Fields of DecoderFailure

0: T1: Error2: Vec<u8>
DecodedDiffersFromOriginal

Test case failure representing mismatch between enum variant produced by decoding from the originally encoded enum variant

Fields of DecodedDiffersFromOriginal

original: T

Original value, which was encoded

decoded: T

The value resulting from decoding encoded original value

ValueMismatch

Test case failure representing mismatch between expected enum variant primitive value and the actual primitive value assigned to the enum variant by the rust compiler

Fields of ValueMismatch

enum_name: &'static str

Name of the enum being tested

variant_name: &'static str

Name of the enum variant being tested

expected: usize

Expected primitive value for the tested enum variant

actual: usize

Actual primitive value of the tested enum variant

EncodedValueMismatch

Test case failure representing failed byte string representation of the encoded enum variant

Fields of EncodedValueMismatch

enum_name: &'static str

Name of the enum being tested

variant_name: &'static str

Name of the enum variant being tested

expected: Vec<u8>

Expected encoded byte string for the tested enum variant

actual: Vec<u8>

Actual encoded byte string of the tested enum variant

DecoderWrongErrorOnUnknownValue

Test case failure representing incorrect decoder error during processing out-of-enum range value

Tuple Fields of DecoderWrongErrorOnUnknownValue

0: u8

Value which was decoded into an enum variant

1: Error

Error which was produced during decoding that value

UnknownDecodesToVariant

Test case failure representing a out-of-enum range primitive value still being interpreted as one of enum variants

Tuple Fields of UnknownDecodesToVariant

0: u8

Value which was decoded into an enum variant

1: T

Enum variant resulting from decoding wrong value

FailedEq

Test case failure due to wrong PartialEq or Eq implementation: enum variant is not equal to itself

Tuple Fields of FailedEq

0: T

Enum variant which is not equal to itself

FailedNe

Test case failure due to wrong PartialEq or Eq implementation: two distinct enum variants are still equal

Tuple Fields of FailedNe

0: T

First of two enum variants which are treated as equal

1: T

Second of two enum variants which are treated as equal

FailedOrd

Test case failure due to wrong PartialOrd or Ord implementation happening when enum variants ordering is broken

Tuple Fields of FailedOrd

0: T

First of two enum variants which are disordered. This variant should smaller than the second one, but Ord operation treats it as a larger one

1: T

Second of two enum variants which are disordered. This variant should larger than the second one, but Ord operation treats it as a smaller one

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

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

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.