[][src]Struct async_coap::message::BufferMessageEncoder

pub struct BufferMessageEncoder<'buf> { /* fields omitted */ }

A class for writing stand-alone messages to a mutable byte slice.

Methods

impl<'buf> BufferMessageEncoder<'buf>[src]

pub const MIN_MESSAGE_BUFFER_LEN: usize[src]

The minimum size buffer that can be passed into new.

Important traits for BufferMessageEncoder<'a>
pub fn new(buffer: &'buf mut [u8]) -> BufferMessageEncoder<'buf>[src]

Creates a new BufferMessageEncoder using the given buffer.

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

Returns a byte slice containing the encoded message.

pub fn msg_token(&self) -> MsgToken[src]

Returns the token set for this message.

Trait Implementations

impl<'buf> MessageWrite for BufferMessageEncoder<'buf>[src]

fn append_payload_string(&mut self, body: &str) -> Result<(), Error>[src]

Appends bytes from the UTF8 representation of the given string slice body to the payload of the message. This method should only be called after the token and all options have been set. This method may be called multiple times, each time appending data to the payload. Read more

fn append_payload_u8(&mut self, b: u8) -> Result<(), Error>[src]

Appends a single byte to the payload of the message. This method should only be called after the token and all options have been set. This method may be called multiple times, each time appending data to the payload. Read more

fn append_payload_char(&mut self, c: char) -> Result<(), Error>[src]

Appends the UTF8 representation for a single unicode character to the payload of the message. This method should only be called after the token and all options have been set. This method may be called multiple times, each time appending data to the payload. Read more

impl<'buf> OptionInsert for BufferMessageEncoder<'buf>[src]

fn insert_option_empty(&mut self, key: OptionNumber) -> Result<(), Error>[src]

Inserts an option into the message with no value. Calling this method with out-of-order keys will incur a significant performance penalty. Read more

fn insert_option_with_str(
    &mut self,
    key: OptionNumber,
    value: &str
) -> Result<(), Error>
[src]

Inserts an option into the message with a string value. Calling this method with out-of-order keys will incur a significant performance penalty. Read more

fn insert_option_with_u32(
    &mut self,
    key: OptionNumber,
    value: u32
) -> Result<(), Error>
[src]

Inserts an option into the message with an integer value. Calling this method with out-of-order keys will incur a significant performance penalty. Read more

impl<'buf> Deref for BufferMessageEncoder<'buf>[src]

type Target = [u8]

The resulting type after dereferencing.

impl<'buf> Display for BufferMessageEncoder<'buf>[src]

impl<'buf> Debug for BufferMessageEncoder<'buf>[src]

impl<'a> Write for BufferMessageEncoder<'a>[src]

fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>1.36.0[src]

Like write, except that it writes from a slice of buffers. Read more

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>1.0.0[src]

Writes a formatted string into this writer, returning any error encountered. Read more

fn by_ref(&mut self) -> &mut Self1.0.0[src]

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

impl<'buf> Send for BufferMessageEncoder<'buf>

impl<'buf> Unpin for BufferMessageEncoder<'buf>

impl<'buf> Sync for BufferMessageEncoder<'buf>

impl<'buf> !UnwindSafe for BufferMessageEncoder<'buf>

impl<'buf> RefUnwindSafe for BufferMessageEncoder<'buf>

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,