EncapsulatedBody

Enum EncapsulatedBody 

Source
pub enum EncapsulatedBody<GrpcBody, WebBody> {
    Grpc(GrpcBody),
    Web(WebBody),
}
Expand description

Type to encapsulate both inner services HttpBody types

Because poll_data(cx) and poll_trailers(cx) uses pinned reference, this enum needs to project the pin.

This enum is used as the body type in EncapsulatedFuture.

Variants§

§

Grpc(GrpcBody)

Encapsulates the body from Grpc service

§

Web(WebBody)

Encapsulates the body from Web service

Trait Implementations§

Source§

impl<GrpcBody, WebBody, GrpcError, WebError> Body for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: HttpBody<Error = GrpcError>, WebBody: HttpBody<Error = WebError>, GrpcBody::Error: Into<Box<dyn Error + Send + Sync + 'static>>, WebBody::Error: Into<Box<dyn Error + Send + Sync + 'static>>, GrpcBody::Data: Into<Bytes>, WebBody::Data: Into<Bytes>,

Source§

type Data = Bytes

Values yielded by the Body.
Source§

type Error = Box<dyn Error + Sync + Send>

The error type this Body might generate.
Source§

fn poll_data( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Self::Data, Self::Error>>>

Attempt to pull out the next data buffer of this stream.
Source§

fn poll_trailers( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Option<HeaderMap>, Self::Error>>

Poll for an optional single HeaderMap of trailers. Read more
Source§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
Source§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
Source§

fn data(&mut self) -> Data<'_, Self>
where Self: Sized + Unpin,

Returns future that resolves to next data chunk, if any.
Source§

fn trailers(&mut self) -> Trailers<'_, Self>
where Self: Sized + Unpin,

Returns future that resolves to trailers, if any.
Source§

fn map_data<F, B>(self, f: F) -> MapData<Self, F>
where Self: Sized, F: FnMut(Self::Data) -> B, B: Buf,

Maps this body’s data value to a different value.
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Self::Error) -> E,

Maps this body’s error value to a different value.
Source§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into Collected body which will collect all the DATA frames and trailers.
Source§

fn boxed(self) -> BoxBody<Self::Data, Self::Error>
where Self: Sized + Send + Sync + 'static,

Turn this body into a boxed trait object.
Source§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.
Source§

impl<'pin, GrpcBody, WebBody> Unpin for EncapsulatedBody<GrpcBody, WebBody>
where PinnedFieldsOf<__EncapsulatedBody<'pin, GrpcBody, WebBody>>: Unpin,

Auto Trait Implementations§

§

impl<GrpcBody, WebBody> Freeze for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: Freeze, WebBody: Freeze,

§

impl<GrpcBody, WebBody> RefUnwindSafe for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: RefUnwindSafe, WebBody: RefUnwindSafe,

§

impl<GrpcBody, WebBody> Send for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: Send, WebBody: Send,

§

impl<GrpcBody, WebBody> Sync for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: Sync, WebBody: Sync,

§

impl<GrpcBody, WebBody> UnwindSafe for EncapsulatedBody<GrpcBody, WebBody>
where GrpcBody: UnwindSafe, WebBody: UnwindSafe,

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
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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