pub struct RestJson1 { /* private fields */ }Expand description
Stateful schema-driven restJson1 protocol implementation.
Defaults to skipping escape validation in discarded strings.
Set customizationConfig.protocols for this protocol to {"validateSkippedValues":true}
to validate escape syntax without decoding Unicode escapes.
UTF-8, unescaped control characters, and structural syntax remain checked in either mode.
Trait Implementations§
Source§impl MetadataRoutedProtocol for RestJson1
impl MetadataRoutedProtocol for RestJson1
Source§fn from_build_context(
ctx: &ProtocolBuildContext<'_>,
) -> Result<Self, RouterBuildError>
fn from_build_context( ctx: &ProtocolBuildContext<'_>, ) -> Result<Self, RouterBuildError>
Builds this protocol for a service, from its registered configuration. Invalid
configuration fails the service build.
Source§fn build_router(
&self,
ctx: RouterBuildContext<'_>,
) -> Result<impl MetadataProtocolRouter + 'static + use<>, RouterBuildError>
fn build_router( &self, ctx: RouterBuildContext<'_>, ) -> Result<impl MetadataProtocolRouter + 'static + use<>, RouterBuildError>
Builds operation routing once for this service. Read more
Source§fn event_stream_framing(&self) -> Option<EventStreamFraming<'_>>
fn event_stream_framing(&self) -> Option<EventStreamFraming<'_>>
Event-frame support, when this protocol supports event streams.
Source§impl ServerProtocol for RestJson1
impl ServerProtocol for RestJson1
Source§fn serialize_rejection(&self, err: DeserializeError) -> Response
fn serialize_rejection(&self, err: DeserializeError) -> Response
restJson1 is the only protocol that keeps Accept and Content-Type failures distinct:
406 and 415, per its From<RequestRejection> mapping. Transport failures answer with the
RuntimeError responses; a constraint violation with the modeled validation error.
Source§fn protocol_id(&self) -> &'static ShapeId<'static>
fn protocol_id(&self) -> &'static ShapeId<'static>
The protocol trait’s shape ID, such as
aws.protocols#restJson1.Source§fn validate_request_headers(
&self,
operation: &OperationSchema<'_>,
headers: &Headers,
) -> Result<(), DeserializeError>
fn validate_request_headers( &self, operation: &OperationSchema<'_>, headers: &Headers, ) -> Result<(), DeserializeError>
Validates request headers for the selected operation before upgrade body collection
and
Self::deserialize_request. Header failures therefore take precedence over
deserialization failures. The built-in protocols check Accept against the response
content type. The default accepts all headers.Source§fn request_body_requirement(
&self,
operation: &OperationSchema<'_>,
) -> BodyDirective
fn request_body_requirement( &self, operation: &OperationSchema<'_>, ) -> BodyDirective
Specifies whether deserialization needs the request body. The default collects it. Read more
Source§fn deserialize_request<'a>(
&'a self,
input: &Schema<'_>,
request: &'a Request<Bytes>,
) -> Result<Box<dyn ShapeDeserializer + 'a>, DeserializeError>
fn deserialize_request<'a>( &'a self, input: &Schema<'_>, request: &'a Request<Bytes>, ) -> Result<Box<dyn ShapeDeserializer + 'a>, DeserializeError>
Source§fn serialize_response(
&self,
output: &Schema<'_>,
value: &dyn SerializableStruct,
) -> Response
fn serialize_response( &self, output: &Schema<'_>, value: &dyn SerializableStruct, ) -> Response
Source§fn serialize_streaming_response(
&self,
output: &Schema<'_>,
value: &dyn SerializableStruct,
_streaming_member: &Schema<'_>,
body: Option<BoxBody>,
) -> Response
fn serialize_streaming_response( &self, output: &Schema<'_>, value: &dyn SerializableStruct, _streaming_member: &Schema<'_>, body: Option<BoxBody>, ) -> Response
Source§fn serialize_error(&self, error: &dyn HttpModeledError) -> Response
fn serialize_error(&self, error: &dyn HttpModeledError) -> Response
Serializes a modeled error with the protocol’s discriminator framing.
Source§fn serialize_routing_error(&self, err: &RoutingError) -> Response
fn serialize_routing_error(&self, err: &RoutingError) -> Response
Converts a routing rejection into this protocol’s response. Read more
Source§fn serialize_runtime_error(&self, error: RuntimeError) -> Response
fn serialize_runtime_error(&self, error: RuntimeError) -> Response
Frames a shared extractor runtime error using this protocol’s runtime-error contract. Read more
Auto Trait Implementations§
impl Freeze for RestJson1
impl !RefUnwindSafe for RestJson1
impl Send for RestJson1
impl Sync for RestJson1
impl Unpin for RestJson1
impl UnsafeUnpin for RestJson1
impl !UnwindSafe for RestJson1
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.