pub struct WellKnownCore<H: Reporting + Handler>(/* private fields */);
Available on crate feature
leaky_names
only.Expand description
Wrapper around a reporting handler that makes all reported resources discoverable at the path
/.well-known/core
.
This can be constructed via crate::ReportingHandlerBuilder::with_wkc(), typically after having gathered all resource in one handler.
Trait Implementations§
source§impl<H: Reporting + Handler> Handler for WellKnownCore<H>
impl<H: Reporting + Handler> Handler for WellKnownCore<H>
§type RequestData = WkcData<<H as Handler>::RequestData>
type RequestData = WkcData<<H as Handler>::RequestData>
§type ExtractRequestError = <H as Handler>::ExtractRequestError
type ExtractRequestError = <H as Handler>::ExtractRequestError
Error type for
extract_request_data()
. Read more§type BuildResponseError<M: MinimalWritableMessage> = WkcBuildResponseError<<M as MinimalWritableMessage>::UnionError, <H as Handler>::BuildResponseError<M>>
type BuildResponseError<M: MinimalWritableMessage> = WkcBuildResponseError<<M as MinimalWritableMessage>::UnionError, <H as Handler>::BuildResponseError<M>>
Error type for writing response data. Read more
source§fn extract_request_data<M: ReadableMessage>(
&mut self,
req: &M
) -> Result<Self::RequestData, Self::ExtractRequestError>
fn extract_request_data<M: ReadableMessage>( &mut self, req: &M ) -> Result<Self::RequestData, Self::ExtractRequestError>
Process an incoming request. Read more
source§fn estimate_length(&mut self, req: &Self::RequestData) -> usize
fn estimate_length(&mut self, req: &Self::RequestData) -> usize
Estimate an upper bound for the number of bytes in the response Read more
source§fn build_response<M: MutableWritableMessage>(
&mut self,
m: &mut M,
req: Self::RequestData
) -> Result<(), Self::BuildResponseError<M>>
fn build_response<M: MutableWritableMessage>( &mut self, m: &mut M, req: Self::RequestData ) -> Result<(), Self::BuildResponseError<M>>
Build a response for the request Read more
source§impl<H: Reporting + Handler> Reporting for WellKnownCore<H>
impl<H: Reporting + Handler> Reporting for WellKnownCore<H>
For reporting, a WellKnownCore handler simply passes on its inner description; the exposed .well-known/core resource is not listed.
Utilizing this (when in having a WellKnownCore handler around the resources, then adding more
resources using HandlerBuilder::at()
, and wrapping the result in a WellKnownCore again) is
wasteful in terms of computation (as the inner one will never be hit), but can be convenient
for composition in examples.
Auto Trait Implementations§
impl<H> RefUnwindSafe for WellKnownCore<H>where
H: RefUnwindSafe,
impl<H> Send for WellKnownCore<H>where
H: Send,
impl<H> Sync for WellKnownCore<H>where
H: Sync,
impl<H> Unpin for WellKnownCore<H>where
H: Unpin,
impl<H> UnwindSafe for WellKnownCore<H>where
H: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<'a, OldRD, OldH> HandlerBuilder<'a, OldRD> for OldHwhere
OldH: Handler<RequestData = OldRD>,
impl<'a, OldRD, OldH> HandlerBuilder<'a, OldRD> for OldHwhere
OldH: Handler<RequestData = OldRD>,
source§fn at<H>(self, path: &'a [&'a str], handler: H) -> ForkingHandler<'a, H, Self>
fn at<H>(self, path: &'a [&'a str], handler: H) -> ForkingHandler<'a, H, Self>
source§fn at_with_attributes<H>(
self,
path: &'a [&'a str],
attributes: &'a [Attribute],
handler: H
) -> ForkingHandler<'a, ConstantSingleRecordReport<'a, H>, Self>
fn at_with_attributes<H>( self, path: &'a [&'a str], attributes: &'a [Attribute], handler: H ) -> ForkingHandler<'a, ConstantSingleRecordReport<'a, H>, Self>
Divert requests arriving at
path
into the given handler
, and announce them with the
given attributes in .well-known/core. Read moresource§impl<'a, OldRD, OldH> ReportingHandlerBuilder<'a, OldRD> for OldH
impl<'a, OldRD, OldH> ReportingHandlerBuilder<'a, OldRD> for OldH
source§fn with_wkc(self) -> WellKnownCore<Self>
fn with_wkc(self) -> WellKnownCore<Self>
Add a
/.well-known/core
resource that exposes the information the previous (stack of)
handler(s) exposes throught the Reporting trait.