pub struct Bincode<E = LittleEndian, I = Varint, L = NoLimit> {
pub configuration: Configuration<E, I, L>,
}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>
impl<E, I, L> Bincode<E, I, L>
Sourcepub const fn new(configuration: Configuration<E, I, L>) -> Self
pub const fn new(configuration: Configuration<E, I, L>) -> Self
Creates a new Bincode given a Configuration.
Sourcepub const fn with_big_endian(self) -> Bincode<BigEndian, I, L>
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.
Sourcepub const fn with_little_endian(self) -> Bincode<LittleEndian, I, L>
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.
Sourcepub const fn with_variable_int_encoding(self) -> Bincode<E, Varint, L>
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.
Sourcepub const fn with_fixed_int_encoding(self) -> Bincode<E, Fixint, L>
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.
Sourcepub const fn with_limit<const N: usize>(self) -> Bincode<E, I, Limit<N>>
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.
Sourcepub const fn with_no_limit(self) -> Bincode<E, I, NoLimit>
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<T, E, I, L> FileFormat<T> for Bincode<E, I, L>
impl<T, E, I, L> FileFormat<T> for Bincode<E, I, L>
Source§type FormatError = BincodeError
type FormatError = BincodeError
to_writer and from_reader.Source§fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>
fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>
Read stream. Read moreSource§fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
Source§fn to_writer<W: Write>(
&self,
writer: W,
value: &T,
) -> Result<(), Self::FormatError>
fn to_writer<W: Write>( &self, writer: W, value: &T, ) -> Result<(), Self::FormatError>
Write stream. Read moreSource§fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>
fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>
Source§fn from_reader_buffered<R>(&self, reader: R) -> Result<T, Self::FormatError>where
R: Read,
fn from_reader_buffered<R>(&self, reader: R) -> Result<T, Self::FormatError>where
R: Read,
FileFormat::from_reader, however the provided reader is buffered with BufReader. Read moreSource§fn to_writer_buffered<W>(
&self,
writer: W,
value: &T,
) -> Result<(), Self::FormatError>where
W: Write,
fn to_writer_buffered<W>(
&self,
writer: W,
value: &T,
) -> Result<(), Self::FormatError>where
W: Write,
FileFormat::to_writer, however the provided writer is buffered with BufWriter. Read more