pub struct GrpcStreamResponse<T> { /* private fields */ }Expand description
Body type for gRPC responses. Yields encoded gRPC data frames and trailers.
Implementations§
Source§impl<T> ResponseBody<T>
impl<T> ResponseBody<T>
Sourcepub fn once(msg: T) -> ResponseBody<T>
pub fn once(msg: T) -> ResponseBody<T>
Create a response body that yields a single message then trailers.
Sourcepub fn channel() -> (ResponseSender<T>, ResponseBody<T>)
pub fn channel() -> (ResponseSender<T>, ResponseBody<T>)
Create a response body backed by a channel for streaming multiple messages.
Sourcepub fn initial_metadata(self, headers: HeaderMap) -> ResponseBody<T>
pub fn initial_metadata(self, headers: HeaderMap) -> ResponseBody<T>
Set initial metadata (response headers) sent alongside the response.
Sourcepub fn trailing_metadata(self, trailers: HeaderMap) -> ResponseBody<T>
pub fn trailing_metadata(self, trailers: HeaderMap) -> ResponseBody<T>
Set trailing metadata merged into the final trailers frame.
These are combined with grpc-status. Trailers pushed via ResponseSender::send_trailers
are appended on top.
Sourcepub fn take_initial_metadata(&mut self) -> Option<HeaderMap>
pub fn take_initial_metadata(&mut self) -> Option<HeaderMap>
Take initial metadata headers, if set.
Sourcepub fn into_response(self, req: Request<()>) -> Response<ResponseBody<T>>
pub fn into_response(self, req: Request<()>) -> Response<ResponseBody<T>>
Convert self into a Response type where self is as the body.
Take in the request it belongs to for potential compression header preparation.
Trait Implementations§
Source§impl<T> Body for ResponseBody<T>
impl<T> Body for ResponseBody<T>
Source§type Data = Bytes
type Data = Bytes
The payload data type yielded by
Frame::Data variants.Source§type Error = ProtocolError
type Error = ProtocolError
The error type that can occur while producing frames.
Source§fn poll_frame(
self: Pin<&mut ResponseBody<T>>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<<ResponseBody<T> as Body>::Data>, <ResponseBody<T> as Body>::Error>>>
fn poll_frame( self: Pin<&mut ResponseBody<T>>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<<ResponseBody<T> as Body>::Data>, <ResponseBody<T> as Body>::Error>>>
Attempt to pull the next frame from the body. Read more
Source§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
Indicates whether the body has been fully consumed. Read more
Auto Trait Implementations§
impl<T> Freeze for ResponseBody<T>where
T: Freeze,
impl<T> RefUnwindSafe for ResponseBody<T>where
T: RefUnwindSafe,
impl<T> Send for ResponseBody<T>where
T: Send,
impl<T> Sync for ResponseBody<T>
impl<T> Unpin for ResponseBody<T>where
T: Unpin,
impl<T> UnsafeUnpin for ResponseBody<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ResponseBody<T>where
T: 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
Mutably borrows from an owned value. Read more