Skip to main content

EventStreamFraming

Struct EventStreamFraming 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§payload_codec: &'a dyn DynCodec

Codec for structured event and initial-message payloads.

§media_type: &'a str

Media type of structured event payloads.

§initial_messages_in_frames: bool

Whether 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: bool

Whether 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: bool

With 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>

Source

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.

Source

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>.

Source

pub fn exception_discriminator(self, discriminator: BodyDiscriminator) -> Self

Sets the body discriminator used for modeled exception payloads.

Source

pub fn exception_http_bindings(self, enabled: bool) -> Self

Applies REST error-body bindings to structured exception payloads.

Source

pub fn initial_messages_in_frames( self, initial_messages_in_frames: bool, ) -> Self

Sets whether non-stream members travel in initial-message frames.

Source

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>

Source§

fn clone(&self) -> EventStreamFraming<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EventStreamFraming<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Copy for EventStreamFraming<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsOut<T> for T
where T: Copy,

§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,