pub trait Error: Display {
// Required methods
fn custom<D: Display>(msg: D, codec: Codec) -> Self;
fn incomplete(needed: Needed, codec: Codec) -> Self;
fn exceeds_max_length(length: BigUint, codec: Codec) -> Self;
fn missing_field(name: &'static str, codec: Codec) -> Self;
fn no_valid_choice(name: &'static str, codec: Codec) -> Self;
fn field_error(name: &'static str, error: DecodeError, codec: Codec) -> Self;
fn duplicate_field(name: &'static str, codec: Codec) -> Self;
fn unknown_field(index: usize, tag: Tag, codec: Codec) -> Self;
}
Expand description
A generic error that can occur while decoding ASN.1.
Caller needs always to pass a crate::Codec
variant to Error
when implementing the decoder
Required Methods§
Sourcefn custom<D: Display>(msg: D, codec: Codec) -> Self
fn custom<D: Display>(msg: D, codec: Codec) -> Self
Creates a new general error using msg
when decoding ASN.1.
Sourcefn incomplete(needed: Needed, codec: Codec) -> Self
fn incomplete(needed: Needed, codec: Codec) -> Self
Creates a new error about needing more data to finish parsing.
Sourcefn exceeds_max_length(length: BigUint, codec: Codec) -> Self
fn exceeds_max_length(length: BigUint, codec: Codec) -> Self
Creates a new error about exceeding the maximum allowed data for a type.
Sourcefn missing_field(name: &'static str, codec: Codec) -> Self
fn missing_field(name: &'static str, codec: Codec) -> Self
Creates a new error about a missing field.
Sourcefn no_valid_choice(name: &'static str, codec: Codec) -> Self
fn no_valid_choice(name: &'static str, codec: Codec) -> Self
Creates a new error about being unable to match any variant in a choice.
Sourcefn field_error(name: &'static str, error: DecodeError, codec: Codec) -> Self
fn field_error(name: &'static str, error: DecodeError, codec: Codec) -> Self
Creates a new error about being unable to decode a field in a compound type, such as a set or sequence.
Sourcefn duplicate_field(name: &'static str, codec: Codec) -> Self
fn duplicate_field(name: &'static str, codec: Codec) -> Self
Creates a new error about finding a duplicate field.
Sourcefn unknown_field(index: usize, tag: Tag, codec: Codec) -> Self
fn unknown_field(index: usize, tag: Tag, codec: Codec) -> Self
Create a new error about unknown field.
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.