Skip to main content

AsyncWriteBytes

Struct AsyncWriteBytes 

Source
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,

Source

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);
Source

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

pub async fn write_u8(&mut self, value: u8) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

pub async fn write_i8(&mut self, value: i8) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source§

impl<W> AsyncWriteBytes<'_, W>
where W: AsyncWriteExt + Unpin,

Source

pub async fn write_u16<E: Endianness>(&mut self, value: u16) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_u32<E: Endianness>(&mut self, value: u32) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_u64<E: Endianness>(&mut self, value: u64) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_u128<E: Endianness>(&mut self, value: u128) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_i16<E: Endianness>(&mut self, value: i16) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_i32<E: Endianness>(&mut self, value: i32) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_i64<E: Endianness>(&mut self, value: i64) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_i128<E: Endianness>(&mut self, value: i128) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_f32<E: Endianness>(&mut self, value: f32) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Source

pub async fn write_f64<E: Endianness>(&mut self, value: f64) -> Result<()>

§Errors

This method returns the same errors as AsyncWriteExt::write_all.

Source

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!

Trait Implementations§

Source§

impl<W> Deref for AsyncWriteBytes<'_, W>
where W: AsyncWriteExt + Unpin,

Source§

type Target = W

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<W> DerefMut for AsyncWriteBytes<'_, W>
where W: AsyncWriteExt + Unpin,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'a, W> From<&'a mut W> for AsyncWriteBytes<'a, W>
where W: AsyncWriteExt + Unpin,

Source§

fn from(writer: &'a mut W) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, W> Freeze for AsyncWriteBytes<'a, W>

§

impl<'a, W> RefUnwindSafe for AsyncWriteBytes<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for AsyncWriteBytes<'a, W>
where W: Send,

§

impl<'a, W> Sync for AsyncWriteBytes<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for AsyncWriteBytes<'a, W>

§

impl<'a, W> !UnwindSafe for AsyncWriteBytes<'a, W>

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<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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.