Struct nix_compat::wire::de::NixReader
source · pub struct NixReader<R> {
inner: R,
buf: BytesMut,
reserved_buf_size: usize,
max_buf_size: usize,
version: ProtocolVersion,
}
Fields§
§inner: R
§buf: BytesMut
§reserved_buf_size: usize
§max_buf_size: usize
§version: ProtocolVersion
Implementations§
source§impl<R> NixReader<R>where
R: AsyncReadExt,
impl<R> NixReader<R>where
R: AsyncReadExt,
source§impl<R> NixReader<R>where
R: AsyncReadExt + Unpin,
impl<R> NixReader<R>where
R: AsyncReadExt + Unpin,
async fn force_fill(&mut self) -> Result<usize>
Trait Implementations§
source§impl<R: AsyncRead> AsyncBufRead for NixReader<R>
impl<R: AsyncRead> AsyncBufRead for NixReader<R>
source§impl<R> NixRead for NixReader<R>
impl<R> NixRead for NixReader<R>
type Error = Error
source§fn version(&self) -> ProtocolVersion
fn version(&self) -> ProtocolVersion
Some types are serialized differently depending on the version
of the protocol and so this can be used for implementing that.
source§async fn try_read_number(&mut self) -> Result<Option<u64>, Self::Error>
async fn try_read_number(&mut self) -> Result<Option<u64>, Self::Error>
Read a single u64 from the protocol.
This returns an Option to support graceful shutdown.
source§async fn try_read_bytes_limited(
&mut self,
limit: RangeInclusive<usize>,
) -> Result<Option<Bytes>, Self::Error>
async fn try_read_bytes_limited( &mut self, limit: RangeInclusive<usize>, ) -> Result<Option<Bytes>, Self::Error>
Read bytes from the protocol.
A size limit on the returned bytes has to be specified.
This returns an Option to support graceful shutdown.
source§fn try_read_bytes(
&mut self,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send + '_
fn try_read_bytes( &mut self, ) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send + '_
Read bytes from the protocol without a limit.
The default implementation just calls
try_read_bytes_limited
with a
limit of 0..=usize::MAX
but other implementations are free to have a
reader wide limit.
This returns an Option to support graceful shutdown.source§fn read_bytes(
&mut self,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send + '_
fn read_bytes( &mut self, ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send + '_
Read bytes from the protocol.
The default implementation just calls
read_bytes_limited
with a
limit of 0..=usize::MAX
but other implementations are free to have a
reader wide limit.
This will return an error if the bytes could not be read.source§fn read_number(
&mut self,
) -> impl Future<Output = Result<u64, Self::Error>> + Send + '_
fn read_number( &mut self, ) -> impl Future<Output = Result<u64, Self::Error>> + Send + '_
Read a single u64 from the protocol.
This will return an error if the number could not be read.
source§fn read_bytes_limited(
&mut self,
limit: RangeInclusive<usize>,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send + '_
fn read_bytes_limited( &mut self, limit: RangeInclusive<usize>, ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send + '_
Read bytes from the protocol.
A size limit on the returned bytes has to be specified.
This will return an error if the number could not be read.
source§fn read_value<V: NixDeserialize>(
&mut self,
) -> impl Future<Output = Result<V, Self::Error>> + Send + '_
fn read_value<V: NixDeserialize>( &mut self, ) -> impl Future<Output = Result<V, Self::Error>> + Send + '_
Read a value from the protocol.
Uses
NixDeserialize::deserialize
to read a value.source§fn try_read_value<V: NixDeserialize>(
&mut self,
) -> impl Future<Output = Result<Option<V>, Self::Error>> + Send + '_
fn try_read_value<V: NixDeserialize>( &mut self, ) -> impl Future<Output = Result<Option<V>, Self::Error>> + Send + '_
Read a value from the protocol.
Uses
NixDeserialize::try_deserialize
to read a value.
This returns an Option to support graceful shutdown.impl<'__pin, R> Unpin for NixReader<R>where
__Origin<'__pin, R>: Unpin,
Auto Trait Implementations§
impl<R> Freeze for NixReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for NixReader<R>where
R: RefUnwindSafe,
impl<R> Send for NixReader<R>where
R: Send,
impl<R> Sync for NixReader<R>where
R: Sync,
impl<R> UnwindSafe for NixReader<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
source§fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
source§fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
Reads all bytes until a newline (the 0xA byte) is reached, and append
them to the provided buffer. Read more
source§fn split(self, byte: u8) -> Split<Self>
fn split(self, byte: u8) -> Split<Self>
Returns a stream of the contents of this reader split on the byte
byte
. Read moresource§fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
Returns the contents of the internal buffer, filling it with more
data from the inner reader if it is empty. Read more
source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
Pulls some bytes from this source into the specified buffer,
returning how many bytes were read. Read more
source§fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
Pulls some bytes from this source into the specified buffer,
advancing the buffer’s internal cursor. Read more
source§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
Reads the exact number of bytes required to fill
buf
. Read moresource§fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
Reads an unsigned 8 bit integer from the underlying reader. Read more
source§fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
Reads a signed 8 bit integer from the underlying reader. Read more
source§fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
Reads an unsigned 16-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
Reads a signed 16-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
Reads an unsigned 32-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
Reads a signed 32-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
Reads an unsigned 64-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
Reads an signed 64-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
Reads an unsigned 128-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
Reads an signed 128-bit integer in big-endian order from the
underlying reader. Read more
source§fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
Reads an 32-bit floating point type in big-endian order from the
underlying reader. Read more
source§fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
Reads an 64-bit floating point type in big-endian order from the
underlying reader. Read more
source§fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
Reads an unsigned 16-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
Reads a signed 16-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
Reads an unsigned 32-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
Reads a signed 32-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
Reads an unsigned 64-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
Reads an signed 64-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
Reads an unsigned 128-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
Reads an signed 128-bit integer in little-endian order from the
underlying reader. Read more
source§fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
Reads an 32-bit floating point type in little-endian order from the
underlying reader. Read more
source§fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
Reads an 64-bit floating point type in little-endian order from the
underlying reader. Read more
source§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
Reads all bytes until EOF in this source, placing them into
buf
. Read moresource§fn read_to_string<'a>(
&'a mut self,
dst: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
dst: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
Reads all bytes until EOF in this source, appending them to
buf
. Read moresource§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