Struct coap_message::heapmessage::HeapMessage [−][src]
A heap CoAP message backed by allocated memory
It stores its payload in a Vec
, and uses a BTreeMap<_, Vec<_>>
to
store all the individual option values.
It offers a few methods for direct manipulation of options, even out of sequence, that can not be expected from a general message buffer and are thus not captured in traits.
Implementations
impl HeapMessage
[src]
pub fn new() -> Self
[src]
pub fn change_option(
&mut self,
optnum: u16,
occurrence: usize,
value: impl Into<Vec<u8>>
)
[src]
&mut self,
optnum: u16,
occurrence: usize,
value: impl Into<Vec<u8>>
)
Replace the occurrence'th value of the optnum option in the message
Panics if there's not occurrence + 1
options of that number.
pub fn remove_option(&mut self, optnum: u16, occurrence: usize)
[src]
Remove the occurrence'th option of option number optnum
Panics if there's not occurrence + 1
options of that number.
pub fn add_option(&mut self, optnum: u16, data: &[u8])
[src]
Like MinimalWritableMessage::add_option, but allowing arbitrary access
Trait Implementations
impl Debug for HeapMessage
[src]
impl MinimalWritableMessage for HeapMessage
[src]
type Code = u8
type OptionNumber = u16
fn set_code(&mut self, code: u8)
[src]
fn add_option(&mut self, optnum: u16, data: &[u8])
[src]
fn set_payload(&mut self, payload: &[u8])
[src]
fn set_from_message<'m, M>(&mut self, msg: &'m M) where
M: ReadableMessage<'m>,
[src]
M: ReadableMessage<'m>,
fn add_option_str(&mut self, number: Self::OptionNumber, value: &str)
[src]
fn add_option_uint<U: Ux>(&mut self, number: Self::OptionNumber, value: U)
[src]
impl<'m> ReadableMessage<'m> for HeapMessage
[src]
type Code = u8
type MessageOption = MessageOption<'m>
type OptionsIter = ReadCursor<'m>
fn code(&self) -> u8
[src]
fn payload(&self) -> &[u8]
[src]
fn options(&'m self) -> ReadCursor<'m>ⓘNotable traits for ReadCursor<'a>
impl<'a> Iterator for ReadCursor<'a> type Item = MessageOption<'a>;
[src]
Notable traits for ReadCursor<'a>
impl<'a> Iterator for ReadCursor<'a> type Item = MessageOption<'a>;
impl<'a> WithSortedOptions<'a> for HeapMessage
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,