Struct coap_lite::CoapRequest
source · [−]pub struct CoapRequest<Endpoint> {
pub message: Packet,
pub response: Option<CoapResponse>,
pub source: Option<Endpoint>,
}Expand description
The CoAP request.
Fields
message: Packetresponse: Option<CoapResponse>source: Option<Endpoint>Implementations
sourceimpl<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
sourceimpl<Endpoint: Clone> Clone for CoapRequest<Endpoint>
impl<Endpoint: Clone> Clone for CoapRequest<Endpoint>
sourcefn clone(&self) -> CoapRequest<Endpoint>
fn clone(&self) -> CoapRequest<Endpoint>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<Endpoint: Debug> Debug for CoapRequest<Endpoint>
impl<Endpoint: Debug> Debug for CoapRequest<Endpoint>
sourceimpl<Endpoint> Default for CoapRequest<Endpoint>
impl<Endpoint> Default for CoapRequest<Endpoint>
sourceimpl<Endpoint: Ord + Clone> From<&'_ CoapRequest<Endpoint>> for RequestCacheKey<Endpoint>
impl<Endpoint: Ord + Clone> From<&'_ CoapRequest<Endpoint>> for RequestCacheKey<Endpoint>
sourcefn from(request: &CoapRequest<Endpoint>) -> Self
fn from(request: &CoapRequest<Endpoint>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more