pub struct SendStream<W = OwnedWriteHalf> { /* private fields */ }Expand description
Framed send stream for length-delimited messages.
Generic over the underlying writer type - works with TCP, TLS, or any AsyncWrite.
Implementations§
Source§impl<W: AsyncWrite + Unpin> SendStream<W>
impl<W: AsyncWrite + Unpin> SendStream<W>
pub fn new(stream: W) -> Self
pub async fn send_batch_message<T: Serialize>(&mut self, obj: &T) -> Result<()>
pub async fn send_control_message<T: Serialize>( &mut self, obj: &T, ) -> Result<()>
Sourcepub async fn send_message_with_data_buffered<T: Serialize, R: AsyncBufRead + Unpin>(
&mut self,
obj: &T,
reader: &mut R,
) -> Result<u64>
pub async fn send_message_with_data_buffered<T: Serialize, R: AsyncBufRead + Unpin>( &mut self, obj: &T, reader: &mut R, ) -> Result<u64>
Sends an object followed by data from a buffered reader.
This method uses copy_buf which avoids internal buffer allocation by using
the reader’s existing buffer. Wrap your reader in BufReader::with_capacity(size, reader)
to control the buffer size.
pub async fn close(&mut self) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for SendStream<W>where
W: Freeze,
impl<W> RefUnwindSafe for SendStream<W>where
W: RefUnwindSafe,
impl<W> Send for SendStream<W>where
W: Send,
impl<W> Sync for SendStream<W>where
W: Sync,
impl<W> Unpin for SendStream<W>where
W: Unpin,
impl<W> UnsafeUnpin for SendStream<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for SendStream<W>where
W: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request