CoapRequest

Struct CoapRequest 

Source
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>

Source

pub fn new() -> CoapRequest<Endpoint>

Creates a new request.

Source

pub fn from_packet(packet: Packet, source: Endpoint) -> CoapRequest<Endpoint>

Creates a request from a packet.

Source

pub fn apply_from_error(&mut self, error: HandlingError) -> bool

Applies the given error to the request and returns true if that was successful.

Source

pub fn set_method(&mut self, method: Method)

Sets the method.

Source

pub fn get_method(&self) -> &Method

Returns the method.

Source

pub fn set_path(&mut self, path: &str)

Sets the path.

Source

pub fn get_path(&self) -> String

Returns the path.

Source

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).

Source

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.

Source

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>

Source§

fn clone(&self) -> CoapRequest<Endpoint>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Endpoint: Debug> Debug for CoapRequest<Endpoint>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Endpoint> Default for CoapRequest<Endpoint>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Endpoint: Ord + Clone> From<&CoapRequest<Endpoint>> for RequestCacheKey<Endpoint>

Source§

fn from(request: &CoapRequest<Endpoint>) -> Self

Converts to this type from the input type.
Source§

impl<Endpoint: PartialEq> PartialEq for CoapRequest<Endpoint>

Source§

fn eq(&self, other: &CoapRequest<Endpoint>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.