pub struct AsyncWriteBytes<'a, W>(/* private fields */)
where
W: AsyncWriteExt + Unpin;Expand description
Wraps a type that implements AsyncWriteExt to extend its functionality with methods for
writing 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, W> AsyncWriteBytes<'a, W>where
W: AsyncWriteExt + Unpin,
impl<'a, W> AsyncWriteBytes<'a, W>where
W: AsyncWriteExt + Unpin,
Sourcepub const fn new(writer: &'a mut W) -> Self
pub const fn new(writer: &'a mut W) -> 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 write_representable<E, Re>(&mut self, value: Re) -> Result<()>where
E: Endianness,
Re: Representable,
pub async fn write_representable<E, Re>(&mut self, value: Re) -> Result<()>where
E: Endianness,
Re: Representable,
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Source§impl<W> AsyncWriteBytes<'_, W>where
W: AsyncWriteExt + Unpin,
impl<W> AsyncWriteBytes<'_, W>where
W: AsyncWriteExt + Unpin,
Sourcepub async fn write_u16<E: Endianness>(&mut self, value: u16) -> Result<()>
pub async fn write_u16<E: Endianness>(&mut self, value: u16) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_u16_ne(&mut self, value: u16) -> Result<()>
pub async fn write_u16_ne(&mut self, value: u16) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_u32<E: Endianness>(&mut self, value: u32) -> Result<()>
pub async fn write_u32<E: Endianness>(&mut self, value: u32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_u32_ne(&mut self, value: u32) -> Result<()>
pub async fn write_u32_ne(&mut self, value: u32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_u64<E: Endianness>(&mut self, value: u64) -> Result<()>
pub async fn write_u64<E: Endianness>(&mut self, value: u64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_u64_ne(&mut self, value: u64) -> Result<()>
pub async fn write_u64_ne(&mut self, value: u64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_u128<E: Endianness>(&mut self, value: u128) -> Result<()>
pub async fn write_u128<E: Endianness>(&mut self, value: u128) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_u128_ne(&mut self, value: u128) -> Result<()>
pub async fn write_u128_ne(&mut self, value: u128) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_i16<E: Endianness>(&mut self, value: i16) -> Result<()>
pub async fn write_i16<E: Endianness>(&mut self, value: i16) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_i16_ne(&mut self, value: i16) -> Result<()>
pub async fn write_i16_ne(&mut self, value: i16) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_i32<E: Endianness>(&mut self, value: i32) -> Result<()>
pub async fn write_i32<E: Endianness>(&mut self, value: i32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_i32_ne(&mut self, value: i32) -> Result<()>
pub async fn write_i32_ne(&mut self, value: i32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_i64<E: Endianness>(&mut self, value: i64) -> Result<()>
pub async fn write_i64<E: Endianness>(&mut self, value: i64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_i64_ne(&mut self, value: i64) -> Result<()>
pub async fn write_i64_ne(&mut self, value: i64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_i128<E: Endianness>(&mut self, value: i128) -> Result<()>
pub async fn write_i128<E: Endianness>(&mut self, value: i128) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_i128_ne(&mut self, value: i128) -> Result<()>
pub async fn write_i128_ne(&mut self, value: i128) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_f32<E: Endianness>(&mut self, value: f32) -> Result<()>
pub async fn write_f32<E: Endianness>(&mut self, value: f32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_f32_ne(&mut self, value: f32) -> Result<()>
pub async fn write_f32_ne(&mut self, value: f32) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!
Sourcepub async fn write_f64<E: Endianness>(&mut self, value: f64) -> Result<()>
pub async fn write_f64<E: Endianness>(&mut self, value: f64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Sourcepub async fn write_f64_ne(&mut self, value: f64) -> Result<()>
pub async fn write_f64_ne(&mut self, value: f64) -> Result<()>
§Errors
This method returns the same errors as AsyncWriteExt::write_all.
Note: This writes using NativeEndian, not NetworkEndian!