Struct coap_message_utils::inmemory_write::Message
source · pub struct Message<'a> { /* private fields */ }Expand description
A message writing into a preallocated buffer
Implementations§
Trait Implementations§
source§impl<'a> MinimalWritableMessage for Message<'a>
impl<'a> MinimalWritableMessage for Message<'a>
type Code = u8
type OptionNumber = u16
fn set_code(&mut self, code: u8)
fn set_payload(&mut self, payload: &[u8])
source§fn set_from_message<M>(&mut self, msg: &M)where
M: ReadableMessage,
fn set_from_message<M>(&mut self, msg: &M)where
M: ReadableMessage,
Copy code, options and payload in from a readable message Read more
source§fn add_option_str(&mut self, number: Self::OptionNumber, value: &str)
fn add_option_str(&mut self, number: Self::OptionNumber, value: &str)
Shortcut for
add_option(self, number, value.as_bytes()). Read moresource§fn add_option_uint<U>(&mut self, number: Self::OptionNumber, value: U)where
U: Ux,
fn add_option_uint<U>(&mut self, number: Self::OptionNumber, value: U)where
U: Ux,
Shortcut for
add_option on a buffer containing the uint encoded value Read moresource§impl<'a> MutableWritableMessage for Message<'a>
impl<'a> MutableWritableMessage for Message<'a>
source§fn available_space(&self) -> usize
fn available_space(&self) -> usize
Number of bytes available for additional options, payload marker and payload
source§fn payload_mut(&mut self) -> &mut [u8]
fn payload_mut(&mut self) -> &mut [u8]
👎Deprecated since 0.1.1: Use payload_mut_with_len instead
Legacy method for mutable access to the payload Read more
source§fn payload_mut_with_len(&mut self, len: usize) -> &mut [u8]
fn payload_mut_with_len(&mut self, len: usize) -> &mut [u8]
Memory-map
len bytes of the payload for writing Read moresource§fn truncate(&mut self, len: usize)
fn truncate(&mut self, len: usize)
Truncate an already-set payload to the given length; that payload must have been written to
before using
MinimalWritableMessage::set_payload, or with a suitable MutableWritableMessage::payload_mut_with_len call. Read more