Skip to main content

BinarySerde

Struct BinarySerde 

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

Implementations§

Source§

impl BinarySerde

Source

pub fn serialize<'a, T: Serialize<'a>>(item: &T) -> Result<Vec<u8>, String>

Source

pub fn deserialize<T: Deserialize>(buffer: Vec<u8>) -> Result<T, String>

Trait Implementations§

Source§

impl Deserializer for BinarySerde

Source§

fn read_u8(&mut self) -> Result<u8, String>

Source§

fn read_u16(&mut self) -> Result<u16, String>

Source§

fn read_u32(&mut self) -> Result<u32, String>

Source§

fn read_u64(&mut self) -> Result<u64, String>

Source§

fn read_u128(&mut self) -> Result<u128, String>

Source§

fn read_i8(&mut self) -> Result<i8, String>

Source§

fn read_i16(&mut self) -> Result<i16, String>

Source§

fn read_i32(&mut self) -> Result<i32, String>

Source§

fn read_i64(&mut self) -> Result<i64, String>

Source§

fn read_i128(&mut self) -> Result<i128, String>

Source§

fn read_f32(&mut self) -> Result<f32, String>

Source§

fn read_f64(&mut self) -> Result<f64, String>

Source§

fn read_bool(&mut self) -> Result<bool, String>

Source§

fn read_bytes(&mut self) -> Result<Vec<u8>, String>

Source§

fn read_string(&mut self) -> Result<String, String>

Source§

fn read_seq<F, T>(&mut self, f: F) -> Result<T, String>
where F: FnOnce(&mut Self, usize) -> Result<T, String>,

Source§

fn read_map<F, T>(&mut self, f: F) -> Result<T, String>
where F: FnOnce(&mut Self, usize) -> Result<T, String>,

Source§

fn read_tuple<F, T>(&mut self, _len: usize, f: F) -> Result<T, String>
where F: FnOnce(&mut Self) -> Result<T, String>,

Source§

fn read_struct<F, T>( &mut self, _name: &str, _fields: &[&str], f: F, ) -> Result<T, String>
where F: FnOnce(&mut Self) -> Result<T, String>,

Source§

fn read_enum<F, T>( &mut self, _enum_name: &str, _variants: &[&str], f: F, ) -> Result<T, String>
where F: FnOnce(&mut Self, u32) -> Result<T, String>,

Source§

impl<'a> Serializer<'a> for BinarySerde

Source§

fn write_u8(&mut self, n: u8)

Source§

fn write_u16(&mut self, n: u16)

Source§

fn write_u32(&mut self, n: u32)

Source§

fn write_u64(&mut self, n: u64)

Source§

fn write_u128(&mut self, n: u128)

Source§

fn write_i8(&mut self, n: i8)

Source§

fn write_i16(&mut self, n: i16)

Source§

fn write_i32(&mut self, n: i32)

Source§

fn write_i64(&mut self, n: i64)

Source§

fn write_i128(&mut self, n: i128)

Source§

fn write_f32(&mut self, n: f32)

Source§

fn write_f64(&mut self, n: f64)

Source§

fn write_bool(&mut self, b: bool)

Source§

fn write_bytes(&mut self, bytes: &[u8])

Source§

fn write_string(&mut self, s: &str)

Source§

fn write_seq<F>(&mut self, len: usize, f: F)
where F: FnOnce(&mut Self),

Source§

fn write_map<F>(&mut self, len: usize, f: F)
where F: FnOnce(&mut Self),

Source§

fn write_struct<F>(&mut self, _name: &str, _fields: &[&str], f: F)
where F: FnOnce(&mut Self),

Source§

fn write_tuple<F>(&mut self, _len: usize, f: F)
where F: FnOnce(&mut Self),

Source§

fn write_enum<F>( &mut self, _enum_name: &str, variant_index: u32, _variant_name: &'a [&'a str], f: F, )
where F: FnOnce(&mut Self),

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.