pub struct ServerResponseSink<Resp: Send + 'static> { /* private fields */ }Expand description
Sink for server gRPC response.
Implementations§
Source§impl<Resp: Send> ServerResponseSink<Resp>
impl<Resp: Send> ServerResponseSink<Resp>
Sourcepub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), StreamDead>>
pub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), StreamDead>>
This method returns Poll::Ready when the sink is available to accept data
otherwise subscribe current task which will be notified when this
stream is ready to accept data.
Higher level wrapper (future) is ready.
Sourcepub async fn ready(&mut self) -> Result<(), StreamDead>
pub async fn ready(&mut self) -> Result<(), StreamDead>
A future is resolved when the sink is available to receive more data.
Sourcepub fn send_metadata(&mut self, metadata: Metadata) -> Result<()>
pub fn send_metadata(&mut self, metadata: Metadata) -> Result<()>
Send response metadata.
This function returns error if metadata is already sent.
Sourcepub fn send_data(&mut self, message: Resp) -> Result<()>
pub fn send_data(&mut self, message: Resp) -> Result<()>
Send response data.
This function does not block, but if send window is not available, data is queued.
ready function can be used to wait for windows availability.
Sourcepub fn send_trailers(&mut self, metadata: Metadata) -> Result<()>
pub fn send_trailers(&mut self, metadata: Metadata) -> Result<()>
Send trailers after the response.
This function must be called after data is sent, otherwise the response stream is reset.
Sourcepub fn send_grpc_error(
&mut self,
status: GrpcStatus,
message: String,
) -> Result<()>
pub fn send_grpc_error( &mut self, status: GrpcStatus, message: String, ) -> Result<()>
Send error.
Auto Trait Implementations§
impl<Resp> Freeze for ServerResponseSink<Resp>
impl<Resp> !RefUnwindSafe for ServerResponseSink<Resp>
impl<Resp> Send for ServerResponseSink<Resp>
impl<Resp> !Sync for ServerResponseSink<Resp>
impl<Resp> Unpin for ServerResponseSink<Resp>
impl<Resp> !UnwindSafe for ServerResponseSink<Resp>
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