#[non_exhaustive]pub struct RouterBuildContext<'a> {
pub service: &'static ServiceSchema<'static>,
pub targets: &'a [OperationTarget],
pub config: &'a ServiceConfig,
pub protocol_settings: Option<&'a Document>,
}Expand description
Everything a protocol sees when building its router: the service, the
assigned targets, the shared service configuration, and the protocol’s own
settings section. Self::service_protocols lets a protocol detect conflicting
combinations or adapt its claim behavior using the existing service schema.
Constructed by the routing service builder, so a protocol never sees another
protocol’s settings.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.service: &'static ServiceSchema<'static>The service schema.
targets: &'a [OperationTarget]The operations to route, with targets assigned by the routing service.
config: &'a ServiceConfigTyped service-wide configuration shared by every protocol.
protocol_settings: Option<&'a Document>This protocol’s section of ProtocolOptions::protocol_settings, when
one was configured.
Implementations§
Source§impl RouterBuildContext<'_>
impl RouterBuildContext<'_>
Sourcepub fn service_protocols(&self) -> &'static [ShapeId<'static>]
pub fn service_protocols(&self) -> &'static [ShapeId<'static>]
Returns the protocols served by this service in schema order, not claim order.
Includes this protocol, but excludes registered protocols the service does not serve. The slice borrows the static service schema and can be retained by the router without copying it or borrowing the build context.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RouterBuildContext<'a>
impl<'a> !RefUnwindSafe for RouterBuildContext<'a>
impl<'a> Send for RouterBuildContext<'a>
impl<'a> Sync for RouterBuildContext<'a>
impl<'a> Unpin for RouterBuildContext<'a>
impl<'a> UnsafeUnpin for RouterBuildContext<'a>
impl<'a> !UnwindSafe for RouterBuildContext<'a>
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
§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>
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>
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 more