pub struct HttpBindingProtocol<C> { /* private fields */ }Expand description
An HTTP protocol for REST-style APIs that use HTTP bindings.
This protocol splits input members between HTTP locations (headers, query
strings, URI labels) and the payload based on HTTP binding traits
(@httpHeader, @httpQuery, @httpLabel, @httpPayload, etc.).
Non-bound members are serialized into the body using the provided codec.
§Type parameters
C— the payload codec (e.g.,JsonCodec,XmlCodec)
Implementations§
Source§impl<C: Codec> HttpBindingProtocol<C>
impl<C: Codec> HttpBindingProtocol<C>
Sourcepub fn new(protocol_id: ShapeId, codec: C, content_type: &'static str) -> Self
pub fn new(protocol_id: ShapeId, codec: C, content_type: &'static str) -> Self
Creates a new HTTP binding protocol.
Sourcepub fn codec(&self) -> &C
pub fn codec(&self) -> &C
Returns a reference to the body codec. Used by wrapper protocols
(e.g. AwsRestXmlProtocol) that need to construct and pre-configure
a body serializer before delegating to
serialize_request_with_body.
Sourcepub fn serialize_request_with_body(
&self,
body: <C as Codec>::Serializer,
input: &dyn SerializableStruct,
input_schema: &Schema,
endpoint: &str,
cfg: &ConfigBag,
) -> Result<Request, SerdeError>
pub fn serialize_request_with_body( &self, body: <C as Codec>::Serializer, input: &dyn SerializableStruct, input_schema: &Schema, endpoint: &str, cfg: &ConfigBag, ) -> Result<Request, SerdeError>
Body-providable variant of serialize_request.
The caller supplies an already-constructed body serializer, allowing
codec-specific pre-configuration (e.g. setting one-shot state on the
body codec before binding-driven serialization begins). The default
serialize_request implementation calls this with a fresh serializer
from the codec.
This is the extension point used by AwsRestXmlProtocol to inject the
member-level @xmlName for an @httpPayload struct member into the
body codec — a value the codec couldn’t otherwise see because codegen
passes the target shape’s SCHEMA for that member, which carries
the target’s @xmlName but not the member’s.
Trait Implementations§
Source§impl<C> ClientProtocolInner for HttpBindingProtocol<C>
impl<C> ClientProtocolInner for HttpBindingProtocol<C>
Source§fn protocol_id(&self) -> &ShapeId
fn protocol_id(&self) -> &ShapeId
Source§fn serialize_request(
&self,
input: &dyn SerializableStruct,
input_schema: &Schema,
endpoint: &str,
cfg: &ConfigBag,
) -> Result<Request, SerdeError>
fn serialize_request( &self, input: &dyn SerializableStruct, input_schema: &Schema, endpoint: &str, cfg: &ConfigBag, ) -> Result<Request, SerdeError>
Source§fn deserialize_response<'a>(
&self,
response: &'a Response,
_output_schema: &Schema,
_cfg: &ConfigBag,
) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
fn deserialize_response<'a>( &self, response: &'a Response, _output_schema: &Schema, _cfg: &ConfigBag, ) -> Result<Box<dyn ShapeDeserializer + 'a>, SerdeError>
ShapeDeserializer over
the response body. Read moreSource§fn payload_codec(&self) -> Option<&dyn DynCodec>
fn payload_codec(&self) -> Option<&dyn DynCodec>
Source§fn update_endpoint(
&self,
request: &mut Request,
endpoint: &Endpoint,
cfg: &ConfigBag,
) -> Result<(), SerdeError>
fn update_endpoint( &self, request: &mut Request, endpoint: &Endpoint, cfg: &ConfigBag, ) -> Result<(), SerdeError>
Auto Trait Implementations§
impl<C> Freeze for HttpBindingProtocol<C>where
C: Freeze,
impl<C> RefUnwindSafe for HttpBindingProtocol<C>where
C: RefUnwindSafe,
impl<C> Send for HttpBindingProtocol<C>where
C: Send,
impl<C> Sync for HttpBindingProtocol<C>where
C: Sync,
impl<C> Unpin for HttpBindingProtocol<C>where
C: Unpin,
impl<C> UnsafeUnpin for HttpBindingProtocol<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for HttpBindingProtocol<C>where
C: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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