#[non_exhaustive]pub struct EventStreamFraming<'a> {
pub payload_codec: &'a dyn DynCodec,
pub media_type: &'a str,
pub initial_messages_in_frames: bool,
pub unset_initial_response_payload: &'static [u8],
pub exception_discriminator: Option<BodyDiscriminator>,
pub exception_http_bindings: bool,
pub xml_exception_codec: Option<&'a dyn DynCodec>,
pub xml_exceptions_wrapped: bool,
}Expand description
The event-frame capability of a metadata-routed protocol, as plain data.
Answered by MetadataRoutedProtocol::event_stream_framing; a protocol that does not
support event streams answers None. Body-routed protocols cannot express this at all:
body-first routing collects the body before selecting an operation, and an event-stream
body must not be collected.
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.payload_codec: &'a dyn DynCodecCodec for structured event and initial-message payloads.
media_type: &'a strMedia type of structured event payloads.
initial_messages_in_frames: boolWhether non-stream members travel in initial-message frames.
This controls their payload and initial-request handling, not whether an explicitly requested initial-response frame is emitted.
unset_initial_response_payload: &'static [u8]Initial-response payload when non-stream members travel in HTTP bindings instead.
Used when initial_messages_in_frames is false.
Generated serde REST JSON sends {}; REST XML sends zero bytes.
exception_discriminator: Option<BodyDiscriminator>Optional body discriminator for modeled exception frames.
exception_http_bindings: boolWhether HTTP-bound exception members are excluded from the frame payload.
xml_exception_codec: Option<&'a dyn DynCodec>Codec for received exception frames that carry a REST XML error envelope, as generated serde
restXml servers expect. The codec reads the <Error> element without validating its
root name.
xml_exceptions_wrapped: boolWith xml_exception_codec: whether the <Error> element is
wrapped in <ErrorResponse> (the default) or is the root (@restXml(noErrorWrapping: true)).
Implementations§
Source§impl<'a> EventStreamFraming<'a>
impl<'a> EventStreamFraming<'a>
Sourcepub fn new(payload_codec: &'a dyn DynCodec, media_type: &'a str) -> Self
pub fn new(payload_codec: &'a dyn DynCodec, media_type: &'a str) -> Self
Framing with the given payload codec and media type; non-stream members do not travel
in initial-message frames unless initial_messages_in_frames
is set.
Sourcepub fn xml_exceptions(self, codec: &'a dyn DynCodec, wrapped: bool) -> Self
pub fn xml_exceptions(self, codec: &'a dyn DynCodec, wrapped: bool) -> Self
Reads received exception frames from a REST XML error envelope with codec, which must
not validate the root element name: <ErrorResponse><Error>..</Error></ErrorResponse>
when wrapped, otherwise <Error>..</Error>.
Sourcepub fn exception_discriminator(self, discriminator: BodyDiscriminator) -> Self
pub fn exception_discriminator(self, discriminator: BodyDiscriminator) -> Self
Sets the body discriminator used for modeled exception payloads.
Sourcepub fn exception_http_bindings(self, enabled: bool) -> Self
pub fn exception_http_bindings(self, enabled: bool) -> Self
Applies REST error-body bindings to structured exception payloads.
Sourcepub fn initial_messages_in_frames(
self,
initial_messages_in_frames: bool,
) -> Self
pub fn initial_messages_in_frames( self, initial_messages_in_frames: bool, ) -> Self
Sets whether non-stream members travel in initial-message frames.
Sourcepub fn unset_initial_response_payload(self, payload: &'static [u8]) -> Self
pub fn unset_initial_response_payload(self, payload: &'static [u8]) -> Self
Sets the initial-response payload for protocols whose non-stream members use HTTP bindings. Defaults to zero bytes; ignored when initial messages carry output members.
Trait Implementations§
Source§impl<'a> Clone for EventStreamFraming<'a>
impl<'a> Clone for EventStreamFraming<'a>
Source§fn clone(&self) -> EventStreamFraming<'a>
fn clone(&self) -> EventStreamFraming<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for EventStreamFraming<'a>
impl<'a> Debug for EventStreamFraming<'a>
impl<'a> Copy for EventStreamFraming<'a>
Auto Trait Implementations§
impl<'a> Freeze for EventStreamFraming<'a>
impl<'a> !RefUnwindSafe for EventStreamFraming<'a>
impl<'a> Send for EventStreamFraming<'a>
impl<'a> Sync for EventStreamFraming<'a>
impl<'a> Unpin for EventStreamFraming<'a>
impl<'a> UnsafeUnpin for EventStreamFraming<'a>
impl<'a> !UnwindSafe for EventStreamFraming<'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
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