Struct AsyncProstWriter

Source
pub struct AsyncProstWriter<W, T, D> { /* private fields */ }
Expand description

A warpper around an async sink that accepts, serializes, and sends prost-encoded values.

Implementations§

Source§

impl<W, T, D> AsyncProstWriter<W, T, D>

Source

pub fn new(writer: W) -> Self

create a new async prost writer

Source

pub fn get_ref(&self) -> &W

Gets a reference to the underlying writer.

Source

pub fn get_mut(&mut self) -> &mut W

Gets a mutable reference to the underlying writer.

Source

pub fn into_inner(self) -> W

Unwraps this AsyncProstWriter, returning the underlying writer.

Note that any leftover serialized data that has not yet been sent is lost.

Source§

impl<W, T> AsyncProstWriter<W, T, SyncDestination>

Source

pub fn for_async(self) -> AsyncProstWriter<W, T, AsyncDestination>

make this writer include the serialized data’s size before each serialized value.

Source

pub fn for_async_framed(self) -> AsyncProstWriter<W, T, AsyncFrameDestination>

make this writer include the serialized data’s header and body size before serialized value

Trait Implementations§

Source§

impl<W: Debug, T: Debug, D: Debug> Debug for AsyncProstWriter<W, T, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W, T> Default for AsyncProstWriter<W, T, SyncDestination>
where W: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<W, T> From<W> for AsyncProstWriter<W, T, SyncDestination>

Source§

fn from(writer: W) -> Self

Converts to this type from the input type.
Source§

impl<W, T, D> Sink<T> for AsyncProstWriter<W, T, D>
where W: AsyncWrite + Unpin, Self: ProstWriterFor<T>,

Source§

type Error = Error

The type of value produced by the sink when an error occurs.
Source§

fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the Sink to receive a value. Read more
Source§

fn start_send(self: Pin<&mut Self>, item: T) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from this sink. Read more
Source§

fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary. Read more
Source§

impl<W, T, D> Unpin for AsyncProstWriter<W, T, D>

Auto Trait Implementations§

§

impl<W, T, D> Freeze for AsyncProstWriter<W, T, D>
where W: Freeze,

§

impl<W, T, D> RefUnwindSafe for AsyncProstWriter<W, T, D>

§

impl<W, T, D> Send for AsyncProstWriter<W, T, D>
where W: Send, T: Send, D: Send,

§

impl<W, T, D> Sync for AsyncProstWriter<W, T, D>
where W: Sync, T: Sync, D: Sync,

§

impl<W, T, D> UnwindSafe for AsyncProstWriter<W, T, D>
where W: UnwindSafe, T: UnwindSafe, D: UnwindSafe,

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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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