Struct transmog_async::TransmogReader
source · pub struct TransmogReader<R, T, F> { /* private fields */ }
Expand description
A wrapper around an asynchronous reader that produces an asynchronous stream of Transmog-decoded values.
To use, provide a reader that implements [AsyncRead
], and then use
[Stream
] to access the deserialized values.
Note that the sender must prefix each serialized item with its size
encoded using ordered-varint
.
Implementations§
source§impl<R, T, F> TransmogReader<R, T, F>
impl<R, T, F> TransmogReader<R, T, F>
sourcepub fn get_ref(&self) -> &R
pub fn get_ref(&self) -> &R
Gets a reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
sourcepub fn get_mut(&mut self) -> &mut R
pub fn get_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
sourcepub fn buffer(&self) -> &[u8] ⓘ
pub fn buffer(&self) -> &[u8] ⓘ
Returns a reference to the internally buffered data.
This will not attempt to fill the buffer if it is empty.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this TransmogReader
, returning the underlying reader.
Note that any leftover data in the internal buffer is lost.
source§impl<R, T, F> TransmogReader<R, T, F>
impl<R, T, F> TransmogReader<R, T, F>
sourcepub fn new(reader: R, format: F) -> Self
pub fn new(reader: R, format: F) -> Self
Returns a new instance that reads format
-encoded data for reader
.
sourcepub fn default_for(format: F) -> Selfwhere
R: Default,
pub fn default_for(format: F) -> Selfwhere R: Default,
Returns a new instance that reads format
-encoded data for R::default()
.