pub struct AsyncReadBytes<'a, R>(/* private fields */)
where
R: AsyncReadExt + Unpin;Expand description
Wraps a type that implements AsyncReadExt to extend its functionality with methods for
reading numbers (for futures_lite::io).
Note: This is a struct wrapper instead of a trait like in the original byteorder crate because
it would require for either extremely painful code or to import the heavy proc-macro crate that
is async-trait
Implementations§
Source§impl<'a, R> AsyncReadBytes<'a, R>where
R: AsyncReadExt + Unpin,
impl<'a, R> AsyncReadBytes<'a, R>where
R: AsyncReadExt + Unpin,
Sourcepub const fn new(reader: &'a mut R) -> Self
pub const fn new(reader: &'a mut R) -> Self
Creates a new AsyncReadBytes wrapper around the given reader.
§Examples
use futures_byteorder::AsyncReadBytes;
use futures_lite::io::Cursor;
let data = vec![0x12, 0x34];
let mut reader = Cursor::new(data);
let reader = AsyncReadBytes::new(&mut reader);Sourcepub async fn read_representable<E, Re>(&mut self) -> Result<Re>where
E: Endianness,
Re: Representable,
pub async fn read_representable<E, Re>(&mut self) -> Result<Re>where
E: Endianness,
Re: Representable,
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Source§impl<R> AsyncReadBytes<'_, R>where
R: AsyncReadExt + Unpin,
impl<R> AsyncReadBytes<'_, R>where
R: AsyncReadExt + Unpin,
Sourcepub async fn read_u16<E: Endianness>(&mut self) -> Result<u16>
pub async fn read_u16<E: Endianness>(&mut self) -> Result<u16>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u16_ne(&mut self) -> Result<u16>
pub async fn read_u16_ne(&mut self) -> Result<u16>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u32<E: Endianness>(&mut self) -> Result<u32>
pub async fn read_u32<E: Endianness>(&mut self) -> Result<u32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u32_ne(&mut self) -> Result<u32>
pub async fn read_u32_ne(&mut self) -> Result<u32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u64<E: Endianness>(&mut self) -> Result<u64>
pub async fn read_u64<E: Endianness>(&mut self) -> Result<u64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u64_ne(&mut self) -> Result<u64>
pub async fn read_u64_ne(&mut self) -> Result<u64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u128<E: Endianness>(&mut self) -> Result<u128>
pub async fn read_u128<E: Endianness>(&mut self) -> Result<u128>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_u128_ne(&mut self) -> Result<u128>
pub async fn read_u128_ne(&mut self) -> Result<u128>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i16<E: Endianness>(&mut self) -> Result<i16>
pub async fn read_i16<E: Endianness>(&mut self) -> Result<i16>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i16_ne(&mut self) -> Result<i16>
pub async fn read_i16_ne(&mut self) -> Result<i16>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i32<E: Endianness>(&mut self) -> Result<i32>
pub async fn read_i32<E: Endianness>(&mut self) -> Result<i32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i32_ne(&mut self) -> Result<i32>
pub async fn read_i32_ne(&mut self) -> Result<i32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i64<E: Endianness>(&mut self) -> Result<i64>
pub async fn read_i64<E: Endianness>(&mut self) -> Result<i64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i64_ne(&mut self) -> Result<i64>
pub async fn read_i64_ne(&mut self) -> Result<i64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i128<E: Endianness>(&mut self) -> Result<i128>
pub async fn read_i128<E: Endianness>(&mut self) -> Result<i128>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_i128_ne(&mut self) -> Result<i128>
pub async fn read_i128_ne(&mut self) -> Result<i128>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_f32<E: Endianness>(&mut self) -> Result<f32>
pub async fn read_f32<E: Endianness>(&mut self) -> Result<f32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_f32_ne(&mut self) -> Result<f32>
pub async fn read_f32_ne(&mut self) -> Result<f32>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_f64<E: Endianness>(&mut self) -> Result<f64>
pub async fn read_f64<E: Endianness>(&mut self) -> Result<f64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.
Sourcepub async fn read_f64_ne(&mut self) -> Result<f64>
pub async fn read_f64_ne(&mut self) -> Result<f64>
§Errors
This method returns the same errors as AsyncReadExt::read_exact.