[][src]Struct simple_tlv::Encoder

pub struct Encoder<'a> { /* fields omitted */ }

SIMPLE-TLV encoder.

Implementations

impl<'a> Encoder<'a>[src]

pub fn new(bytes: &'a mut [u8]) -> Self[src]

Create a new encoder with the given byte slice as a backing buffer.

pub fn encode<T: Encodable>(&mut self, encodable: &T) -> Result<()>[src]

Encode a value which impls the Encodable trait.

pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>[src]

Return an error with the given ErrorKind, annotating it with context about where the error occurred.

pub fn is_failed(&self) -> bool[src]

Did the decoding operation fail due to an error?

pub fn finish(self) -> Result<&'a [u8]>[src]

Finish encoding to the buffer, returning a slice containing the data written to the buffer.

pub fn encode_tagged_collection(
    &mut self,
    tag: Tag,
    encodables: &[&dyn Encodable]
) -> Result<()>
[src]

Encode a collection of values which impl the Encodable trait under a given tag.

pub fn encode_untagged_collection(
    &mut self,
    encodables: &[&dyn Encodable]
) -> Result<()>
[src]

Encode a collection of values which impl the Encodable trait under a given tag.

Trait Implementations

impl<'a> Debug for Encoder<'a>[src]

Auto Trait Implementations

impl<'a> Send for Encoder<'a>[src]

impl<'a> Sync for Encoder<'a>[src]

impl<'a> Unpin for Encoder<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.