[][src]Struct veriform::encoder::Encoder

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

Veriform encoder

Implementations

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

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

Create a new Encoder which writes into the provided buffer

pub fn uint64(
    &mut self,
    tag: Tag,
    critical: bool,
    value: u64
) -> Result<(), Error>
[src]

Write a field containing an unsigned 64-bit integer

pub fn sint64(
    &mut self,
    tag: Tag,
    critical: bool,
    value: i64
) -> Result<(), Error>
[src]

Write a field containing a signed 64-bit integer

pub fn message(
    &mut self,
    tag: Tag,
    critical: bool,
    message: &dyn Message
) -> Result<(), Error>
[src]

Write a message (nested inside of a field)

pub fn message_seq<'m>(
    &mut self,
    tag: Tag,
    critical: bool,
    length: usize,
    messages: impl Iterator<Item = &'m dyn Message>
) -> Result<(), Error>
[src]

Write a sequence of messages (nested inside of a field)

pub fn bytes(
    &mut self,
    tag: Tag,
    critical: bool,
    bytes: &[u8]
) -> Result<(), Error>
[src]

Write a field containing bytes

pub fn string(
    &mut self,
    tag: Tag,
    critical: bool,
    string: &str
) -> Result<(), Error>
[src]

Write a field containing a string

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

Finish constructing a message, returning a slice of the buffer containing the serialized message

Auto Trait Implementations

impl<'a> RefUnwindSafe for Encoder<'a>

impl<'a> Send for Encoder<'a>

impl<'a> Sync for Encoder<'a>

impl<'a> Unpin for Encoder<'a>

impl<'a> !UnwindSafe for Encoder<'a>

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> Same<T> for T

type Output = T

Should always be Self

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.