Struct SimpleSliceSerializer

Source
pub struct SimpleSliceSerializer<'a> { /* private fields */ }
Expand description

This struct implements a simple serializer that writes data into a borrowed byte slice.

Implementations§

Source§

impl<'a> SimpleSliceSerializer<'a>

Source

pub fn new(slice: &'a mut [u8]) -> Self

Creates a new instance with a given initial capacity.

Source

pub fn offset(&self) -> usize

Returns the current offset.

Source

pub fn available(&self) -> usize

Returns the number of available bytes.

Trait Implementations§

Source§

impl<'a> SimpleDataSerializer for SimpleSliceSerializer<'a>

Source§

fn write(&mut self, v: &[u8]) -> Result<()>

Writes the byte slice. Read more
Source§

fn write_u8(&mut self, v: u8) -> Result<()>

Writes an u8 value. Read more
Source§

fn write_u16(&mut self, v: u16) -> Result<()>

Writes an u16 value. Read more
Source§

fn write_u32(&mut self, v: u32) -> Result<()>

Writes an u32 value. Read more
Source§

fn write_u64(&mut self, v: u64) -> Result<()>

Writes an u64 value. Read more
Source§

fn write_i8(&mut self, v: i8) -> Result<()>

Writes an i8 value. Read more
Source§

fn write_i16(&mut self, v: i16) -> Result<()>

Writes an i16 value. Read more
Source§

fn write_i32(&mut self, v: i32) -> Result<()>

Writes an i32 value. Read more
Source§

fn write_i64(&mut self, v: i64) -> Result<()>

Writes an i64 value. Read more
Source§

fn write_f32(&mut self, v: f32) -> Result<()>

Writes a f32 value. Read more
Source§

fn write_f64(&mut self, v: f64) -> Result<()>

Writes a f64 value. Read more
Source§

fn write_byte_array(&mut self, v: &[u8]) -> Result<()>

Writes a byte array. The size of the byte array is encoded as an u16 value followed by the bytes of the array. Read more

Auto Trait Implementations§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V