native_model::bincode_1_3

Struct Bincode

Source
pub struct Bincode;
Expand description

Used to specify that the bincode 1.3 crate is to be used for serialization & deserialization.

§Warning

bincode does not implement all serde features. Errors may be encountered when using this with some types.

If you are encountering errors when using this codec on your types, try using the rmp_serde_1_3 codec instead.

§Basic usage

Use the with attribute on your type to instruct native_model to use Bincode for serialization & deserialization.

Example usage:

#[derive(Clone, Default, serde::Deserialize, serde::Serialize)]
#[native_model(id = 1, version = 1, with = native_model::bincode_1_3::Bincode)]
struct MyStruct {
    my_string: String
}

Trait Implementations§

Source§

impl<T: for<'de> Deserialize<'de>> Decode<T> for Bincode

Source§

fn decode(data: Vec<u8>) -> Result<T, Self::Error>

Deserializes a type from bytes using the bincode 1.3 crate.

Source§

type Error = Box<ErrorKind>

Source§

impl Default for Bincode

Source§

fn default() -> Bincode

Returns the “default value” for a type. Read more
Source§

impl<T: Serialize> Encode<T> for Bincode

Source§

fn encode(obj: &T) -> Result<Vec<u8>, Self::Error>

Serializes a type into bytes using the bincode 1.3 crate.

Source§

type Error = Box<ErrorKind>

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.