pub struct CoapRequest<Endpoint> {
pub message: Packet,
pub response: Option<CoapResponse>,
pub source: Option<Endpoint>,
}Expand description
The CoAP request.
Fields§
§message: Packet§response: Option<CoapResponse>§source: Option<Endpoint>Implementations§
Source§impl<Endpoint> CoapRequest<Endpoint>
impl<Endpoint> CoapRequest<Endpoint>
Sourcepub fn new() -> CoapRequest<Endpoint>
pub fn new() -> CoapRequest<Endpoint>
Creates a new request.
Sourcepub fn from_packet(packet: Packet, source: Endpoint) -> CoapRequest<Endpoint>
pub fn from_packet(packet: Packet, source: Endpoint) -> CoapRequest<Endpoint>
Creates a request from a packet.
Sourcepub fn apply_from_error(&mut self, error: HandlingError) -> bool
pub fn apply_from_error(&mut self, error: HandlingError) -> bool
Applies the given error to the request and returns true if that was successful.
Sourcepub fn set_method(&mut self, method: Method)
pub fn set_method(&mut self, method: Method)
Sets the method.
Sourcepub fn get_method(&self) -> &Method
pub fn get_method(&self) -> &Method
Returns the method.
Sourcepub fn get_path_as_vec(
&self,
) -> Result<Vec<String>, IncompatibleOptionValueFormat>
pub fn get_path_as_vec( &self, ) -> Result<Vec<String>, IncompatibleOptionValueFormat>
Returns the path as a vector (as it is encoded in CoAP rather than in HTTP-style paths).
Sourcepub fn get_observe_flag(&self) -> Option<Result<ObserveOption, InvalidObserve>>
pub fn get_observe_flag(&self) -> Option<Result<ObserveOption, InvalidObserve>>
Returns the flag in the Observe option or InvalidObserve if the flag was provided but not understood.
Sourcepub fn set_observe_flag(&mut self, flag: ObserveOption)
pub fn set_observe_flag(&mut self, flag: ObserveOption)
Sets the flag in the Observe option.
Trait Implementations§
Source§impl<Endpoint: Clone> Clone for CoapRequest<Endpoint>
impl<Endpoint: Clone> Clone for CoapRequest<Endpoint>
Source§fn clone(&self) -> CoapRequest<Endpoint>
fn clone(&self) -> CoapRequest<Endpoint>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Endpoint: Debug> Debug for CoapRequest<Endpoint>
impl<Endpoint: Debug> Debug for CoapRequest<Endpoint>
Source§impl<Endpoint> Default for CoapRequest<Endpoint>
impl<Endpoint> Default for CoapRequest<Endpoint>
Source§impl<Endpoint: Ord + Clone> From<&CoapRequest<Endpoint>> for RequestCacheKey<Endpoint>
impl<Endpoint: Ord + Clone> From<&CoapRequest<Endpoint>> for RequestCacheKey<Endpoint>
Source§fn from(request: &CoapRequest<Endpoint>) -> Self
fn from(request: &CoapRequest<Endpoint>) -> Self
Converts to this type from the input type.
Source§impl<Endpoint: PartialEq> PartialEq for CoapRequest<Endpoint>
impl<Endpoint: PartialEq> PartialEq for CoapRequest<Endpoint>
impl<Endpoint> StructuralPartialEq for CoapRequest<Endpoint>
Auto Trait Implementations§
impl<Endpoint> Freeze for CoapRequest<Endpoint>where
Endpoint: Freeze,
impl<Endpoint> RefUnwindSafe for CoapRequest<Endpoint>where
Endpoint: RefUnwindSafe,
impl<Endpoint> Send for CoapRequest<Endpoint>where
Endpoint: Send,
impl<Endpoint> Sync for CoapRequest<Endpoint>where
Endpoint: Sync,
impl<Endpoint> Unpin for CoapRequest<Endpoint>where
Endpoint: Unpin,
impl<Endpoint> UnwindSafe for CoapRequest<Endpoint>where
Endpoint: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more