ServerResponseSink

Struct ServerResponseSink 

Source
pub struct ServerResponseSink<Resp: Send + 'static> { /* private fields */ }
Expand description

Sink for server gRPC response.

Implementations§

Source§

impl<Resp: Send> ServerResponseSink<Resp>

Source

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.

Source

pub async fn ready(&mut self) -> Result<(), StreamDead>

A future is resolved when the sink is available to receive more data.

Source

pub fn send_metadata(&mut self, metadata: Metadata) -> Result<()>

Send response metadata.

This function returns error if metadata is already sent.

Source

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.

Source

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.

Source

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