pub struct TBytesWriter<B>where
B: TBytesWriterBackend,{ /* private fields */ }
Expand description
Writes primitive types and arrays of primitive types into TBytesWriterBackend
.
Implementations§
source§impl<B> TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriter<B>where
B: TBytesWriterBackend,
sourcepub fn new(backend: B) -> TBytesWriter<B>
pub fn new(backend: B) -> TBytesWriter<B>
Default constructor.
Trait Implementations§
source§impl<B> Clone for TBytesWriter<B>where
B: Clone + TBytesWriterBackend,
impl<B> Clone for TBytesWriter<B>where
B: Clone + TBytesWriterBackend,
source§fn clone(&self) -> TBytesWriter<B>
fn clone(&self) -> TBytesWriter<B>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<B> Debug for TBytesWriter<B>where
B: Debug + TBytesWriterBackend,
impl<B> Debug for TBytesWriter<B>where
B: Debug + TBytesWriterBackend,
source§impl<'de, B> Deserialize<'de> for TBytesWriter<B>where
B: TBytesWriterBackend + Deserialize<'de>,
impl<'de, B> Deserialize<'de> for TBytesWriter<B>where
B: TBytesWriterBackend + Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TBytesWriter<B>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TBytesWriter<B>, <__D as Deserializer<'de>>::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>>
impl<'a> From<&'a mut [u8]> for TBytesWriter<TBytesWriterSliceBackend<'a>>
source§fn from(value: &'a mut [u8]) -> TBytesWriter<TBytesWriterSliceBackend<'a>>
fn from(value: &'a mut [u8]) -> TBytesWriter<TBytesWriterSliceBackend<'a>>
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>where
B: TBytesWriterBackend + Serialize,
impl<B> Serialize for TBytesWriter<B>where
B: TBytesWriterBackend + Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl<B> TBytesWriterFor<f32> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<f32> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: f32) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<f64> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<f64> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: f64) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<i128> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<i128> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: i128) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<i16> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<i16> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: i16) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<i32> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<i32> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: i32) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<i64> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<i64> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: i64) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<i8> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<i8> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: i8) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<u128> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<u128> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: u128) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<u16> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<u16> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: u16) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<u32> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<u32> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: u32) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<u64> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<u64> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: u64) -> Result<usize, TBytesError>
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>
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>
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 moresource§impl<B> TBytesWriterFor<u8> for TBytesWriter<B>where
B: TBytesWriterBackend,
impl<B> TBytesWriterFor<u8> for TBytesWriter<B>where
B: TBytesWriterBackend,
source§fn write(&mut self, value: u8) -> Result<usize, TBytesError>
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>
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>
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 moreAuto 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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)