Struct flexiber::TaggedValue

source ·
pub struct TaggedValue<V, T = Tag> { /* private fields */ }
Expand description

BER-TLV data object.

Implementations§

source§

impl<V, T> TaggedValue<V, T>
where T: Copy,

source

pub fn new(tag: T, value: V) -> Self

source

pub fn tag(&self) -> T

source§

impl<'a, T> TaggedValue<Slice<'a>, T>
where T: Copy,

source

pub fn from(tag: T, slice: &'a [u8]) -> Result<Self>

Create a new tagged slice, checking lengths.

source

pub fn as_bytes(&self) -> &'a [u8]

Borrow the inner byte slice.

source

pub fn length(&self) -> Length

Get the length of the inner byte slice.

source

pub fn is_empty(&self) -> bool

Is the inner byte slice empty?

source

pub fn decode_nested<F, R>(&self, f: F) -> Result<R>
where F: FnOnce(&mut Decoder<'a>) -> Result<R>,

Decode nested values, creating a new Decoder for the data contained in the sequence’s body and passing it to the provided FnOnce.

Trait Implementations§

source§

impl<V: Clone, T: Clone> Clone for TaggedValue<V, T>

source§

fn clone(&self) -> TaggedValue<V, T>

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<V: Debug, T: Debug> Debug for TaggedValue<V, T>

source§

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

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

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

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<V: PartialEq, T: PartialEq> PartialEq for TaggedValue<V, T>

source§

fn eq(&self, other: &TaggedValue<V, T>) -> bool

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

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

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

impl<V: Copy, T: Copy> Copy for TaggedValue<V, T>

source§

impl<V: Eq, T: Eq> Eq for TaggedValue<V, T>

source§

impl<V, T> StructuralEq for TaggedValue<V, T>

source§

impl<V, T> StructuralPartialEq for TaggedValue<V, T>

Auto Trait Implementations§

§

impl<V, T> RefUnwindSafe for TaggedValue<V, T>

§

impl<V, T> Send for TaggedValue<V, T>
where T: Send, V: Send,

§

impl<V, T> Sync for TaggedValue<V, T>
where T: Sync, V: Sync,

§

impl<V, T> Unpin for TaggedValue<V, T>
where T: Unpin, V: Unpin,

§

impl<V, T> UnwindSafe for TaggedValue<V, T>
where T: UnwindSafe, V: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.