Struct BinarySerializer

Source
pub struct BinarySerializer { /* private fields */ }

Implementations§

Source§

impl BinarySerializer

Source

pub fn new(config: Config) -> Self

Creates a new BinarySerializer with the specified configuration.

Source

pub fn output(self) -> BytesMut

Consumes the serializer and returns the serialized output as BytesMut.

Source

pub fn config(&self) -> &Config

Returns the current configuration of the serializer.

Source

pub fn size(&self) -> usize

Returns a mutable reference to the output buffer.

Source

pub fn container_length(&mut self, length: usize)

Writes the length of a container (e.g., sequence, string) to the output buffer based on the configured endianness and container length strategy.

Source

pub fn bool(&mut self, v: bool) -> Result<()>

Source

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

Source

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

Source

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

Source

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

Source

pub fn i128(&mut self, v: i128) -> Result<()>

Source

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

Source

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

Source

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

Source

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

Source

pub fn u128(&mut self, v: u128) -> Result<()>

Source

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

Source

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

Source

pub fn char(&mut self, v: char) -> Result<()>

Source

pub fn str(&mut self, v: &str) -> Result<()>

Source

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

Trait Implementations§

Source§

impl Debug for BinarySerializer

Source§

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

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

impl Default for BinarySerializer

Source§

fn default() -> BinarySerializer

Returns the “default value” for a type. 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.