[−][src]Struct coap_lite::Packet
The CoAP packet.
Fields
header: Header
payload: Vec<u8>
Methods
impl Packet
[src]
pub fn new() -> Packet
[src]
Creates a new packet.
pub fn options(&self) -> Iter<'a, usize, LinkedList<Vec<u8>>>
[src]
Returns an iterator over the options of the packet.
pub fn set_token(&mut self, token: Vec<u8>)
[src]
Sets the token.
pub fn get_token(&self) -> &Vec<u8>
[src]
Returns the token.
pub fn set_option(&mut self, tp: CoapOption, value: LinkedList<Vec<u8>>)
[src]
Sets an option's values.
pub fn get_option(&self, tp: CoapOption) -> Option<&LinkedList<Vec<u8>>>
[src]
Returns an option's values.
pub fn add_option(&mut self, tp: CoapOption, value: Vec<u8>)
[src]
Adds an option value.
pub fn clear_option(&mut self, tp: CoapOption)
[src]
Removes an option.
pub fn set_content_format(&mut self, cf: ContentFormat)
[src]
Sets the content-format.
pub fn get_content_format(&self) -> Option<ContentFormat>
[src]
Returns the content-format.
pub fn set_observe(&mut self, value: Vec<u8>)
[src]
Sets the value of the observe option.
pub fn get_observe(&self) -> Option<&Vec<u8>>
[src]
Returns the value of the observe option.
pub fn from_bytes(buf: &[u8]) -> Result<Packet, MessageError>
[src]
Decodes a byte slice and constructs the equivalent packet.
pub fn to_bytes(&self) -> Result<Vec<u8>, MessageError>
[src]
Returns a vector of bytes representing the Packet.
Trait Implementations
impl Debug for Packet
[src]
impl Clone for Packet
[src]
fn clone(&self) -> Packet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for Packet
[src]
Auto Trait Implementations
Blanket Implementations
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.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.