Skip to main content

OptBlockError

Enum OptBlockError 

Source
pub enum OptBlockError {
Show 16 variants StringTooShort { minimum: usize, actual: usize, }, NonAsciiInput, ExtendedLengthStringTooShort { minimum: usize, actual: usize, }, StringTooShortForLength { required: usize, actual: usize, }, Uninitialized { length: usize, }, InvalidId(String), IdNotSet, NonAsciiData(String), BlockTooLong { maximum: usize, actual: usize, }, InvalidLengthFieldWidth { value: String, expected: usize, }, InvalidLengthFieldHex { value: String, source: ParseIntError, }, LengthFieldTooSmall { minimum: usize, actual: usize, }, InvalidExtendedLengthField(String), InvalidLengthOfLengthField(String), InvalidExtendedLengthHex { value: String, source: ParseIntError, }, ExtendedLengthTooSmall { value: String, },
}
Expand description

Errors produced while constructing, parsing, or serializing TR-31 optional blocks.

Variants§

§

StringTooShort

The supplied optional-block string does not contain the minimum ID and length fields.

Fields

§minimum: usize
§actual: usize
§

NonAsciiInput

Optional blocks are defined using ASCII data and cannot safely be parsed from arbitrary UTF-8 strings.

§

ExtendedLengthStringTooShort

An extended-length optional block must contain at least 256 bytes.

Fields

§minimum: usize
§actual: usize
§

StringTooShortForLength

The encoded optional-block length exceeds the available input.

Fields

§required: usize
§actual: usize
§

Uninitialized

An optional block has not been initialized sufficiently for export.

Fields

§length: usize
§

InvalidId(String)

The optional-block identifier is not supported.

§

IdNotSet

Data was assigned before an optional-block identifier.

§

NonAsciiData(String)

Optional-block data contains non-ASCII characters.

§

BlockTooLong

The complete optional block exceeds the maximum representable size.

Fields

§maximum: usize
§actual: usize
§

InvalidLengthFieldWidth

A normal length field must consist of exactly two hexadecimal characters.

Fields

§value: String
§expected: usize
§

InvalidLengthFieldHex

A normal length field is not valid hexadecimal.

Fields

§value: String
§

LengthFieldTooSmall

A normal optional-block length cannot be smaller than four bytes.

Fields

§minimum: usize
§actual: usize
§

InvalidExtendedLengthField(String)

An extended length field must consist of exactly six characters.

§

InvalidLengthOfLengthField(String)

The first two characters of the extended length field must encode the supported length-of-length value.

§

InvalidExtendedLengthHex

The extended block length is not valid hexadecimal.

Fields

§value: String
§

ExtendedLengthTooSmall

Extended encoding may only be used for block lengths greater than 255 bytes.

Fields

§value: String

Trait Implementations§

Source§

impl Debug for OptBlockError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for OptBlockError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for OptBlockError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

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

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<OptBlockError> for KeyBlockHeaderError

Source§

fn from(error: OptBlockError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.