pub struct SimpleCBORWrapper<H: SimpleCBORHandler> { /* private fields */ }
Expand description
Wrapper for resource handlers that are implemented in terms of GETting, POSTing or PUTting objects in CBOR format.
The wrapper handles all encoding and decoding, options processing (ignoring the critical Uri-Path option under the assumption that that has been already processed by an underlying request router), the corresponding errors and block-wise GETs.
More complex handlers (eg. implementing additional representations, or processing query aprameters into additional data available to the SimpleCBORHandler) can be built by forwarding to this (where any critical but already processed options would need to be masked from the message’s option) or taking inspiration from it.
Implementations
sourceimpl<H: SimpleCBORHandler> SimpleCBORWrapper<H>
impl<H: SimpleCBORHandler> SimpleCBORWrapper<H>
Trait Implementations
sourceimpl<H> Handler for SimpleCBORWrapper<H> where
H: SimpleCBORHandler,
H::Get: Serialize,
H::Post: for<'de> Deserialize<'de>,
H::Put: for<'de> Deserialize<'de>,
impl<H> Handler for SimpleCBORWrapper<H> where
H: SimpleCBORHandler,
H::Get: Serialize,
H::Post: for<'de> Deserialize<'de>,
H::Put: for<'de> Deserialize<'de>,
type RequestData = SimpleCBORRequestData
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
Auto Trait Implementations
impl<H> RefUnwindSafe for SimpleCBORWrapper<H> where
H: RefUnwindSafe,
impl<H> Send for SimpleCBORWrapper<H> where
H: Send,
impl<H> Sync for SimpleCBORWrapper<H> where
H: Sync,
impl<H> Unpin for SimpleCBORWrapper<H> where
H: Unpin,
impl<H> UnwindSafe for SimpleCBORWrapper<H> where
H: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'a, OldRD, OldH> HandlerBuilder<'a, OldRD> for OldH where
OldH: Handler<RequestData = OldRD>,
impl<'a, OldRD, OldH> HandlerBuilder<'a, OldRD> for OldH where
OldH: Handler<RequestData = OldRD>,
sourcefn at<H>(self, path: &'a [&'a str], handler: H) -> ForkingHandler<'a, H, Self> where
H: Handler + Sized,
fn at<H>(self, path: &'a [&'a str], handler: H) -> ForkingHandler<'a, H, Self> where
H: Handler + Sized,
Divert requests arriving at path
into the given handler
. Read more
sourcefn at_with_attributes<H>(
self,
path: &'a [&'a str],
attributes: &'a [Attribute],
handler: H
) -> ForkingHandler<'a, ConstantSingleRecordReport<'a, H>, Self> where
H: Handler + Sized,
fn at_with_attributes<H>(
self,
path: &'a [&'a str],
attributes: &'a [Attribute],
handler: H
) -> ForkingHandler<'a, ConstantSingleRecordReport<'a, H>, Self> where
H: Handler + Sized,
Divert requests arriving at path
into the given handler
, and announce them with the
given attributes in .well-known/core. Read more