Trait coap_handler_implementations::HandlerBuilder [−][src]
pub trait HandlerBuilder<'a, OldRD> where
Self: Handler + Sized, {
fn at<H>(
self,
path: &'a [&'a str],
handler: H
) -> ForkingHandler<'a, H, Self>
where
H: Handler + Sized;
fn below<H>(
self,
path: &'a [&'a str],
handler: H
) -> ForkingTreeHandler<'a, H, Self> { ... }
}
Expand description
Trait implemented by default on all handlers that lets the user stack them using a builder-like syntax.
Note that the resulting ForkingRequestData<ForkingRequestData<…>,()> enums that might look wasteful on paper are optimized into the minimum necessary size since https://github.com/rust-lang/rust/pull/45225. They are, however, suboptimal when it comes to how many times the options are read.
Required methods
Divert requests arriving at path
into the given handler
.
The handler will not not see the Uri-Path (and Uri-Host, as this builder doesn’t do virtual hosting yet) options any more; see the top-level module documentation on Options Hiding for rationale.
Provided methods
Divert requests arriving with an Uri-Path starting with path
to the given handler
.
Only remaining Uri-Path options will be visible to the handler; those expressed in path (and Uri-Host, see [.at()]) are hidden.