Struct Bincode

Source
pub struct Bincode<E = LittleEndian, I = Varint, L = NoLimit> {
    pub configuration: Configuration<E, I, L>,
}
Available on crate feature bincode only.
Expand description

A FileFormat corresponding to the CBOR binary data format. Implemented using the ciborium crate, only compatible with types that implement Decode and Encode.

Fields§

§configuration: Configuration<E, I, L>

The internal Configuration.

Implementations§

Source§

impl<E, I, L> Bincode<E, I, L>

Source

pub const fn new(configuration: Configuration<E, I, L>) -> Self

Creates a new Bincode given a Configuration.

Source

pub const fn with_big_endian(self) -> Bincode<BigEndian, I, L>

Makes bincode encode all integer types in big endian.

Applies with_big_endian to the wrapped Configuration.

Source

pub const fn with_little_endian(self) -> Bincode<LittleEndian, I, L>

Makes bincode encode all integer types in little endian.

Applies with_little_endian to the wrapped Configuration.

Source

pub const fn with_variable_int_encoding(self) -> Bincode<E, Varint, L>

Makes bincode encode all integer types with a variable integer encoding.

Applies with_variable_int_encoding to the wrapped Configuration.

Source

pub const fn with_fixed_int_encoding(self) -> Bincode<E, Fixint, L>

Fixed-size integer encoding.

Applies with_fixed_int_encoding to the wrapped Configuration.

Source

pub const fn with_limit<const N: usize>(self) -> Bincode<E, I, Limit<N>>

Sets the byte limit to limit.

Applies with_limit to the wrapped Configuration.

Source

pub const fn with_no_limit(self) -> Bincode<E, I, NoLimit>

Clear the byte limit.

Applies with_no_limit to the wrapped Configuration.

Trait Implementations§

Source§

impl<E: Clone, I: Clone, L: Clone> Clone for Bincode<E, I, L>

Source§

fn clone(&self) -> Bincode<E, I, L>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug, I: Debug, L: Debug> Debug for Bincode<E, I, L>

Source§

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

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

impl<E: Default, I: Default, L: Default> Default for Bincode<E, I, L>

Source§

fn default() -> Bincode<E, I, L>

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

impl<T, E, I, L> FileFormat<T> for Bincode<E, I, L>
where T: Decode<()> + Encode, Configuration<E, I, L>: Config,

Source§

type FormatError = BincodeError

The type of error to return from to_writer and from_reader.
Source§

fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>

Deserialize a value from a Read stream. Read more
Source§

fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>

Deserialize a value from a byte vec.
Source§

fn to_writer<W: Write>( &self, writer: W, value: &T, ) -> Result<(), Self::FormatError>

Serialize a value into a Write stream. Read more
Source§

fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>

Serialize a value into a byte vec.
Source§

fn from_reader_buffered<R>(&self, reader: R) -> Result<T, Self::FormatError>
where R: Read,

Identical to FileFormat::from_reader, however the provided reader is buffered with BufReader. Read more
Source§

fn to_writer_buffered<W>( &self, writer: W, value: &T, ) -> Result<(), Self::FormatError>
where W: Write,

Identical to FileFormat::to_writer, however the provided writer is buffered with BufWriter. Read more
Source§

impl<E: Copy, I: Copy, L: Copy> Copy for Bincode<E, I, L>

Auto Trait Implementations§

§

impl<E, I, L> Freeze for Bincode<E, I, L>

§

impl<E, I, L> RefUnwindSafe for Bincode<E, I, L>

§

impl<E, I, L> Send for Bincode<E, I, L>
where E: Send, I: Send, L: Send,

§

impl<E, I, L> Sync for Bincode<E, I, L>
where E: Sync, I: Sync, L: Sync,

§

impl<E, I, L> Unpin for Bincode<E, I, L>
where E: Unpin, I: Unpin, L: Unpin,

§

impl<E, I, L> UnwindSafe for Bincode<E, I, L>
where E: UnwindSafe, I: UnwindSafe, L: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.