pub struct ProtocolRegistry { /* private fields */ }Expand description
A const collection of ProtocolRegistrations.
Each protocol may be registered exactly once across every registry a service consults; a duplicate fails the build. Order within a registry carries no meaning.
MultiProtocolRoutingService
always includes Self::BUILTIN. Claim priority comes only from ProtocolOrder
constraints, resolved transitively over all registrations, including protocols the service
does not serve. Reordering registries or the service’s protocol declarations does not change
priority. Constraints must order every pair of served protocols; unordered pairs and cycles
fail the build.
Implementations§
Source§impl ProtocolRegistry
impl ProtocolRegistry
Sourcepub const BUILTIN: ProtocolRegistry
pub const BUILTIN: ProtocolRegistry
The built-in protocols, constrained to the following claim order (first to last):
smithy.protocols#rpcv2Cboraws.protocols#awsJson1_0aws.protocols#awsJson1_1aws.protocols#restJson1aws.protocols#restXml
This follows Smithy’s AWS service protocol precision order for the supported protocols. See also server protocol selection for protocol identification and claiming.
Only protocols declared by the service participate in request routing. Their relative
order remains the same when the service declares a subset of the built-ins.
Additional registrations can position custom protocols using ProtocolOrder, but
there is no per-service override of the built-in relative order. Registering a built-in
again fails the build.
This order affects wire behavior when requests match multiple protocols: the first
definite claim wins; if none exists, the first deferred claim wins, followed by the
first deferred rejection. See the routing documentation.
For example, an eligible request without Content-Type receives deferred claims from
both restJson1 and restXml; restJson1 wins if no protocol claims definitively.
Adding a built-in protocol or changing ordering constraints can change the selected protocol and its response format for ambiguous requests. Such changes require a wire compatibility review.
Sourcepub const fn new(registrations: &'static [ProtocolRegistration]) -> Self
pub const fn new(registrations: &'static [ProtocolRegistration]) -> Self
Creates a registry over registrations.
Sourcepub fn resolve_id(
&self,
service_schema: &'static ServiceSchema<'static>,
protocol_id: &str,
) -> Result<Option<SharedServerProtocol>, RouterBuildError>
pub fn resolve_id( &self, service_schema: &'static ServiceSchema<'static>, protocol_id: &str, ) -> Result<Option<SharedServerProtocol>, RouterBuildError>
Builds the protocol with shape ID protocol_id for service_schema, without settings.
Returns Ok(None) when this registry does not register protocol_id or the schema does not declare
it. Factory failures and registered-ID mismatches return Err.
Use Self::resolve_id_with_settings to supply a protocol’s configuration.
Sourcepub fn resolve_id_with_settings(
&self,
service_schema: &'static ServiceSchema<'static>,
protocol_id: &str,
settings: Option<&Document>,
) -> Result<Option<SharedServerProtocol>, RouterBuildError>
pub fn resolve_id_with_settings( &self, service_schema: &'static ServiceSchema<'static>, protocol_id: &str, settings: Option<&Document>, ) -> Result<Option<SharedServerProtocol>, RouterBuildError>
Builds one declared protocol with its own settings document.
Generated response tests pass the protocol’s section from customizationConfig.protocols
so serialization uses the same options as the generated service builder.
Availability checks and factory errors behave as in Self::resolve_id.
Trait Implementations§
Source§impl Clone for ProtocolRegistry
impl Clone for ProtocolRegistry
Source§fn clone(&self) -> ProtocolRegistry
fn clone(&self) -> ProtocolRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolRegistry
impl Debug for ProtocolRegistry
impl Copy for ProtocolRegistry
Auto Trait Implementations§
impl Freeze for ProtocolRegistry
impl RefUnwindSafe for ProtocolRegistry
impl Send for ProtocolRegistry
impl Sync for ProtocolRegistry
impl Unpin for ProtocolRegistry
impl UnsafeUnpin for ProtocolRegistry
impl UnwindSafe for ProtocolRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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