Trait Error

Source
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§

Source

fn custom<D: Display>(msg: D, codec: Codec) -> Self

Creates a new general error using msg when decoding ASN.1.

Source

fn incomplete(needed: Needed, codec: Codec) -> Self

Creates a new error about needing more data to finish parsing.

Source

fn exceeds_max_length(length: BigUint, codec: Codec) -> Self

Creates a new error about exceeding the maximum allowed data for a type.

Source

fn missing_field(name: &'static str, codec: Codec) -> Self

Creates a new error about a missing field.

Source

fn no_valid_choice(name: &'static str, codec: Codec) -> Self

Creates a new error about being unable to match any variant in a choice.

Source

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.

Source

fn duplicate_field(name: &'static str, codec: Codec) -> Self

Creates a new error about finding a duplicate field.

Source

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.

Implementors§