Enum bcder::decode::Content

source ·
pub enum Content<'a, S: 'a> {
    Primitive(Primitive<'a, S>),
    Constructed(Constructed<'a, S>),
}
Expand description

The content octets of a BER-encoded value.

A value is either primitive, containing actual octets of an actual value, or constructed, in which case its content contains additional BER encoded values. This enum is useful for cases where a certain type may be encoded as either a primitive value or a complex constructed value.

Note that this type represents the content octets only, i.e., it does not contain the tag of the value.

Variants§

§

Primitive(Primitive<'a, S>)

The value is a primitive value.

§

Constructed(Constructed<'a, S>)

The value is a constructed value.

Implementations§

Returns the encoding mode used by the value.

Returns whether this value is a primitive value.

Returns whether this value is a constructed value.

Converts a reference into into one to a primitive value or errors out.

Converts a reference into on to a constructed value or errors out.

Converts content into a u8.

If the content is not primitive or does not contain a single BER encoded INTEGER value between 0 and 256, returns a malformed error.

Skips over the content if it contains an INTEGER of value expected.

The content needs to be primitive and contain a validly encoded integer of value expected or else a malformed error will be returned.

Converts content into a u16.

If the content is not primitive or does not contain a single BER encoded INTEGER value between 0 and 2^16-1, returns a malformed error.

Converts content into a u32.

If the content is not primitive or does not contain a single BER encoded INTEGER value between 0 and 2^32-1, returns a malformed error.

Converts content into a u64.

If the content is not primitive or does not contain a single BER encoded INTEGER value between 0 and 2^64-1, returns a malformed error.

Converts the content into a NULL value.

If the content isn’t primitive and contains a single BER encoded NULL value (i.e., nothing), returns a malformed error.

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

Returns the argument unchanged.

Calls U::from(self).

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

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.