#[non_exhaustive]pub enum SharedProtocolRouter {
Metadata(Box<dyn MetadataProtocolRouter>),
Body(Box<dyn BodyProtocolRouter>),
}Expand description
Operation router built by a server protocol and owned by the shared routing state.
The variant is decided by the protocol’s registration kind: a
MetadataRoutedProtocol can only build a
Metadata router and a
BodyRoutedProtocol a Body one,
so dispatch matching on this enum speaks the claim protocol the registration promised.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Metadata(Box<dyn MetadataProtocolRouter>)
Selects operations from request metadata alone.
Body(Box<dyn BodyProtocolRouter>)
May read collected body bytes to select operations.
Implementations§
Sourcepub fn new(router: impl MetadataProtocolRouter + 'static) -> Self
pub fn new(router: impl MetadataProtocolRouter + 'static) -> Self
Wraps a router that selects from request metadata alone.
Sourcepub fn new_body_routed(router: impl BodyProtocolRouter + 'static) -> Self
pub fn new_body_routed(router: impl BodyProtocolRouter + 'static) -> Self
Wraps a router that selects from the request body the routing service collects.
Trait Implementations§
Auto Trait Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.