pub struct AsyncProstStream<S, R, W, D> { /* private fields */ }Expand description
A wrapper around an async stream that receives and sends prost-encoded values
Implementations§
Source§impl<S, R, W, D> AsyncProstStream<S, R, W, D>
impl<S, R, W, D> AsyncProstStream<S, R, W, D>
Sourcepub fn get_ref(&self) -> &S
pub fn get_ref(&self) -> &S
Gets a reference to the underlying stream.
It is inadvisable to directly read from or write to the underlying stream.
Sourcepub fn get_mut(&mut self) -> &mut S
pub fn get_mut(&mut self) -> &mut S
Gets a mutable reference to the underlying stream.
It is inadvisable to directly read from or write to the underlying stream.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Unwraps this AsyncProstStream, returning the underlying stream.
Note that any leftover serialized data that has not yet been sent, or received data that has not yet been deserialized, is lost.
Source§impl<S, R, W, D> AsyncProstStream<S, R, W, D>
impl<S, R, W, D> AsyncProstStream<S, R, W, D>
Sourcepub fn for_async(self) -> AsyncProstStream<S, R, W, AsyncDestination>
pub fn for_async(self) -> AsyncProstStream<S, R, W, AsyncDestination>
make this stream include the serialized data’s size before each serialized value
Sourcepub fn for_async_framed(
self,
) -> AsyncProstStream<S, R, W, AsyncFrameDestination>
pub fn for_async_framed( self, ) -> AsyncProstStream<S, R, W, AsyncFrameDestination>
make this stream include the serialized data’s size before each serialized value
Sourcepub fn for_sync(self) -> AsyncProstStream<S, R, W, SyncDestination>
pub fn for_sync(self) -> AsyncProstStream<S, R, W, SyncDestination>
Make this stream only send prost-encoded values
Source§impl<R, W, D> AsyncProstStream<TcpStream, R, W, D>
impl<R, W, D> AsyncProstStream<TcpStream, R, W, D>
Sourcepub fn tcp_split(
&mut self,
) -> (AsyncProstReader<ReadHalf<'_>, R, D>, AsyncProstWriter<WriteHalf<'_>, W, D>)
pub fn tcp_split( &mut self, ) -> (AsyncProstReader<ReadHalf<'_>, R, D>, AsyncProstWriter<WriteHalf<'_>, W, D>)
split a TCP-based stream into a read half and a write half
Sourcepub fn tcp_into_split(
self,
) -> (AsyncProstReader<OwnedReadHalf, R, D>, AsyncProstWriter<OwnedWriteHalf, W, D>)
pub fn tcp_into_split( self, ) -> (AsyncProstReader<OwnedReadHalf, R, D>, AsyncProstWriter<OwnedWriteHalf, W, D>)
split a TCP-based stream into a owned read half and a owned write half
this method will consume the ownership
Trait Implementations§
Source§impl<S, R, W> Default for AsyncProstStream<S, R, W, SyncDestination>where
S: Default,
impl<S, R, W> Default for AsyncProstStream<S, R, W, SyncDestination>where
S: Default,
Source§impl<S, R, W> From<S> for AsyncProstStream<S, R, W, SyncDestination>
impl<S, R, W> From<S> for AsyncProstStream<S, R, W, SyncDestination>
Source§impl<S, R, W, D> Sink<W> for AsyncProstStream<S, R, W, D>
impl<S, R, W, D> Sink<W> for AsyncProstStream<S, R, W, D>
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: W) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: W) -> Result<(), Self::Error>
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<S, R, W, D> Stream for AsyncProstStream<S, R, W, D>where
S: Unpin,
AsyncProstReader<InternalAsyncWriter<S, W, D>, R, D>: Stream<Item = Result<R, Error>>,
impl<S, R, W, D> Stream for AsyncProstStream<S, R, W, D>where
S: Unpin,
AsyncProstReader<InternalAsyncWriter<S, W, D>, R, D>: Stream<Item = Result<R, Error>>,
Auto Trait Implementations§
impl<S, R, W, D> Freeze for AsyncProstStream<S, R, W, D>where
S: Freeze,
impl<S, R, W, D> RefUnwindSafe for AsyncProstStream<S, R, W, D>
impl<S, R, W, D> Send for AsyncProstStream<S, R, W, D>
impl<S, R, W, D> Sync for AsyncProstStream<S, R, W, D>
impl<S, R, W, D> Unpin for AsyncProstStream<S, R, W, D>
impl<S, R, W, D> UnwindSafe for AsyncProstStream<S, R, W, D>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more