Trait coap_handler::Handler [−][src]
A CoAP request handler. This gets called by a CoAP server implementation that the handler is assigned to; the server has the handler digest the request's data into a RequestData structure, possibly calls estimate_length before allocating a response message, and then asks the handler to populate the allocated response message with data persisted in the RequestData structure.
Associated Types
type RequestData
[src]
Required methods
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
Implementations on Foreign Types
impl<H> Handler for Option<H> where
H: Handler,
[src]
H: Handler,
An easy way to have resources that may or may not be there in a tree, considering that Handler
is not object safe and thus, if let Some(x) { all = all.at(...)
won't work.
This returns 4.04 Not Found if the inner handler is absent, and otherwise forwards request and response building.
type RequestData = Option<H::RequestData>
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
Implementors
impl Handler for NeverFound
[src]
type RequestData = ()
fn extract_request_data(
&mut self,
_request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
_request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, _request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
_request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
_request: Self::RequestData
)
impl Handler for TypedStaticResponse
[src]
type RequestData = u8
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
impl<'a, RD1, H1, RD2, H2> Handler for ForkingHandler<'a, H1, H2> where
H1: Handler<RequestData = RD1>,
H2: Handler<RequestData = RD2>,
[src]
H1: Handler<RequestData = RD1>,
H2: Handler<RequestData = RD2>,
type RequestData = ForkingRequestData<RD1, RD2>
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
impl<H> Handler for SimpleCBORWrapper<H> where
H: SimpleCBORHandler,
H::Get: Serialize,
H::Post: for<'de> Deserialize<'de>,
H::Put: for<'de> Deserialize<'de>,
[src]
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
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
impl<T> Handler for SimpleRendered<T> where
T: SimpleRenderable,
[src]
T: SimpleRenderable,
type RequestData = SimpleRenderableData
fn extract_request_data(
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
[src]
&mut self,
request: &impl ReadableMessage
) -> Self::RequestData
fn estimate_length(&mut self, _request: &Self::RequestData) -> usize
[src]
fn build_response(
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)
[src]
&mut self,
response: &mut impl MutableWritableMessage,
request: Self::RequestData
)