[−][src]Struct coap_lite::Packet
The CoAP packet.
Fields
header: Headerpayload: Vec<u8>Implementations
impl Packet[src]
pub fn new() -> Packet[src]
Creates a new packet.
pub fn options(&self) -> Iter<'_, 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
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
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>,