diff --git a/flexiber/struct.Tag.html b/flexiber/struct.Tag.html index 79aacc0..d6c18b9 100644 --- a/flexiber/struct.Tag.html +++ b/flexiber/struct.Tag.html @@ -3,7 +3,7 @@ pub constructed: bool, pub number: u16, }
Expand description

The tag field consists of a single byte encoding a tag number from 1 to 254. The values ‘00’ and ‘FF’ are invalid.

-

Fields§

§class: Class§constructed: bool§number: u16

Implementations§

source§

impl Tag

source

pub const BOOLEAN: Self = _

source

pub const INTEGER: Self = _

source

pub const BIT_STRING: Self = _

source

pub const OCTET_STRING: Self = _

source

pub const NULL: Self = _

source

pub const OBJECT_IDENTIFIER: Self = _

source

pub const UTF8_STRING: Self = _

source

pub const PRINTABLE_STRING: Self = _

source

pub const UTC_TIME: Self = _

source

pub const GENERALIZED_TIME: Self = _

source

pub const SEQUENCE: Self = _

source

pub const SET: Self = _

source

pub fn from(class: Class, constructed: bool, number: u16) -> Self

source

pub const fn universal(number: u16) -> Self

source

pub const fn application(number: u16) -> Self

source

pub const fn context(number: u16) -> Self

source

pub const fn private(number: u16) -> Self

source

pub const fn constructed(self) -> Self

Trait Implementations§

source§

impl Clone for Tag

source§

fn clone(&self) -> Tag

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Tag

source§

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

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

impl Decodable<'_> for Tag

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

Attempt to decode this message using the provided decoder.
source§

fn from_bytes(bytes: &'a [u8]) -> Result<Self>

Parse Self from the provided byte slice.
source§

impl Display for Tag

source§

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

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

impl Encodable for Tag

source§

fn encoded_length(&self) -> Result<Length>

Compute the length of this value in bytes when encoded as BER-TLV
source§

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>

Encode this value as BER-TLV using the provided Encoder.
source§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>

Encode this value to the provided byte slice, returning a sub-slice +

Fields§

§class: Class§constructed: bool§number: u16

Implementations§

source§

impl Tag

source

pub const BOOLEAN: Self = _

source

pub const INTEGER: Self = _

source

pub const BIT_STRING: Self = _

source

pub const OCTET_STRING: Self = _

source

pub const NULL: Self = _

source

pub const OBJECT_IDENTIFIER: Self = _

source

pub const UTF8_STRING: Self = _

source

pub const PRINTABLE_STRING: Self = _

source

pub const UTC_TIME: Self = _

source

pub const GENERALIZED_TIME: Self = _

source

pub const SEQUENCE: Self = _

source

pub const SET: Self = _

source

pub fn from(class: Class, constructed: bool, number: u16) -> Self

source

pub const fn universal(number: u16) -> Self

source

pub const fn application(number: u16) -> Self

source

pub const fn context(number: u16) -> Self

source

pub const fn private(number: u16) -> Self

source

pub const fn constructed(self) -> Self

Trait Implementations§

source§

impl Clone for Tag

source§

fn clone(&self) -> Tag

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Tag

source§

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

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

impl Decodable<'_> for Tag

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

Attempt to decode this message using the provided decoder.
source§

fn from_bytes(bytes: &'a [u8]) -> Result<Self>

Parse Self from the provided byte slice.
source§

impl Display for Tag

source§

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

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

impl Encodable for Tag

source§

fn encoded_length(&self) -> Result<Length>

Compute the length of this value in bytes when encoded as BER-TLV
source§

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>

Encode this value as BER-TLV using the provided Encoder.
source§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message.
source§

impl PartialEq for Tag

source§

fn eq(&self, other: &Tag) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TagLike for Tag

source§

fn embedding(self) -> Tag

To stick with one Error type, make sure the tag type can somehow or other be coerced into a BerTag.
source§

fn assert_eq(self, expected: Self) -> Result<Self>

Assert that this Tag matches the provided expected tag. Read more
source§

fn with_value<V>(self, value: V) -> TaggedValue<V, Self>

Ergonomic way to get a TaggedValue for a given tag and value
source§

impl TryFrom<&[u8]> for Tag

source§

type Error = Error

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

fn try_from(encoding: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<u8> for Tag

source§

type Error = Error

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

fn try_from(encoded_value: u8) -> Result<Self>

Performs the conversion.
source§

impl Copy for Tag

source§

impl Eq for Tag

source§

impl StructuralPartialEq for Tag

Auto Trait Implementations§

§

impl Freeze for Tag

§

impl RefUnwindSafe for Tag

§

impl Send for Tag

§

impl Sync for Tag

§

impl Unpin for Tag

§

impl UnwindSafe for Tag

Blanket Implementations§

source§

impl<T> Any for T
where diff --git a/flexiber/trait.Decodable.html b/flexiber/trait.Decodable.html index fa3ddf8..fdaa6ae 100644 --- a/flexiber/trait.Decodable.html +++ b/flexiber/trait.Decodable.html @@ -12,6 +12,6 @@

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decodable<'_> for [u8; 0]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 1]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 2]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 3]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 4]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 5]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 6]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 7]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 8]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 9]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 10]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 11]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 12]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 13]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 14]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 15]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 16]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 17]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 18]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 19]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 20]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 21]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 22]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 23]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 24]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 25]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 26]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 27]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 28]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 29]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 30]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 31]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 32]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl<'a, T> Decodable<'a> for Option<T>
where T: Decodable<'a> + Tagged,

This implementation is quite gotcha-y, since only one byte is peeked.

It should evaluate to the desired tag via Tag::try_from(byte)?.

-
source§

fn decode(decoder: &mut Decoder<'a>) -> Result<Option<T>>

Implementors§

source§

impl Decodable<'_> for Length

source§

impl Decodable<'_> for SimpleTag

source§

impl Decodable<'_> for Tag

source§

impl<'a, T> Decodable<'a> for TaggedSlice<'a, T>
where +
source§

fn decode(decoder: &mut Decoder<'a>) -> Result<Option<T>>

Implementors§

source§

impl Decodable<'_> for Length

source§

impl Decodable<'_> for SimpleTag

source§

impl Decodable<'_> for Tag

source§

impl<'a, T> Decodable<'a> for TaggedSlice<'a, T>
where T: Decodable<'a> + TagLike,

source§

impl<'a, X> Decodable<'a> for X
where X: TryFrom<TaggedSlice<'a>, Error = Error>,

\ No newline at end of file diff --git a/flexiber/trait.Encodable.html b/flexiber/trait.Encodable.html index 8d68e61..7bf31fd 100644 --- a/flexiber/trait.Encodable.html +++ b/flexiber/trait.Encodable.html @@ -48,7 +48,7 @@ containing the encoded message.

source§

fn encoded_length(&self) -> Result<Length>

source§

impl Encodable for [u8; 32]

source§

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>

Encode this value as BER-TLV using the provided Encoder.

source§

fn encoded_length(&self) -> Result<Length>

source§

impl<T> Encodable for Option<T>
where T: Encodable,

source§

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>

Encode this value as BER-TLV using the provided Encoder.

-
source§

fn encoded_length(&self) -> Result<Length>

Implementors§

source§

impl Encodable for Length

source§

impl Encodable for SimpleTag

source§

impl Encodable for Tag

source§

impl<E, T> Encodable for TaggedValue<&E, T>
where +
source§

fn encoded_length(&self) -> Result<Length>

Implementors§

source§

impl Encodable for Length

source§

impl Encodable for SimpleTag

source§

impl Encodable for Tag

source§

impl<E, T> Encodable for TaggedValue<&E, T>
where E: Encodable, T: Copy + Encodable,

source§

impl<T> Encodable for TaggedSlice<'_, T>
where T: Copy + Encodable,

source§

impl<TaggedContainer> Encodable for TaggedContainer
where diff --git a/src/flexiber/tag.rs.html b/src/flexiber/tag.rs.html index b3c8540..416daef 100644 --- a/src/flexiber/tag.rs.html +++ b/src/flexiber/tag.rs.html @@ -283,9 +283,7 @@ 282 283 284 -285 -286 -287
use crate::{
+285

use crate::{
     Decodable, Decoder, Encodable, Encoder, Error, ErrorKind, Length, Result, TaggedValue,
 };
 use core::{
@@ -496,9 +494,7 @@
                 encoder.byte(NOT_LAST_TAG_OCTET_FLAG | (self.number >> 7) as u8)?;
                 encoder.byte((self.number & 0x7F) as u8)
             }
-            0x4000..=0xFFFF => {
-                Err(Error::from(ErrorKind::UnsupportedTagSize))
-            }
+            0x4000..=0xFFFF => Err(Error::from(ErrorKind::UnsupportedTagSize)),
         }
     }
 }