pub struct TBytesWriter<B: TBytesWriterBackend> { /* private fields */ }
Expand description

Writes primitive types and arrays of primitive types into TBytesWriterBackend.

Implementations§

source§

impl<B: TBytesWriterBackend> TBytesWriter<B>

source

pub fn new(backend: B) -> Self

Default constructor.

Trait Implementations§

source§

impl<B: Clone + TBytesWriterBackend> Clone for TBytesWriter<B>

source§

fn clone(&self) -> TBytesWriter<B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug + TBytesWriterBackend> Debug for TBytesWriter<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, B> Deserialize<'de> for TBytesWriter<B>

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> From<&'a mut [u8]> for TBytesWriter<TBytesWriterSliceBackend<'a>>

source§

fn from(value: &'a mut [u8]) -> Self

Constructs TBytesWriter from provided mutable slice.

§Examples
use tbytes::{TBytesWriter, TBytesWriterFor};

let mut buffer = [0, 0];
let mut writer = TBytesWriter::from(buffer.as_mut_slice());

writer.write(511u16).unwrap();
assert_eq!(&buffer, &[255, 1]);
source§

impl<B> Serialize for TBytesWriter<B>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<f32> for TBytesWriter<B>

source§

fn write(&mut self, value: f32) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[f32]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<f64> for TBytesWriter<B>

source§

fn write(&mut self, value: f64) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[f64]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<i128> for TBytesWriter<B>

source§

fn write(&mut self, value: i128) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[i128]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<i16> for TBytesWriter<B>

source§

fn write(&mut self, value: i16) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[i16]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<i32> for TBytesWriter<B>

source§

fn write(&mut self, value: i32) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[i32]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<i64> for TBytesWriter<B>

source§

fn write(&mut self, value: i64) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[i64]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<i8> for TBytesWriter<B>

source§

fn write(&mut self, value: i8) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[i8]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<u128> for TBytesWriter<B>

source§

fn write(&mut self, value: u128) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[u128]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<u16> for TBytesWriter<B>

source§

fn write(&mut self, value: u16) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[u16]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<u32> for TBytesWriter<B>

source§

fn write(&mut self, value: u32) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[u32]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<u64> for TBytesWriter<B>

source§

fn write(&mut self, value: u64) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[u64]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more
source§

impl<B: TBytesWriterBackend> TBytesWriterFor<u8> for TBytesWriter<B>

source§

fn write(&mut self, value: u8) -> Result<usize, TBytesError>

Writes value of type T and returns number of written bytes.
source§

fn write_slice(&mut self, values: &[u8]) -> Result<usize, TBytesError>

Writes slice of values of type T and returns number of written bytes.
source§

fn write_array<const N: usize>( &mut self, values: [T; N] ) -> Result<usize, TBytesError>

Writes array of values of type T and returns number of written bytes. Read more

Auto Trait Implementations§

§

impl<B> Freeze for TBytesWriter<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for TBytesWriter<B>
where B: RefUnwindSafe,

§

impl<B> Send for TBytesWriter<B>
where B: Send,

§

impl<B> Sync for TBytesWriter<B>
where B: Sync,

§

impl<B> Unpin for TBytesWriter<B>
where B: Unpin,

§

impl<B> UnwindSafe for TBytesWriter<B>
where B: UnwindSafe,

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<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,