Struct singlefile_formats::cbor_serde::Cbor
source · pub struct Cbor;
Available on crate feature
cbor-serde
only.Expand description
A FileFormat
corresponding to the CBOR binary data format.
Implemented using the ciborium
crate, only compatible with serde
types.
Trait Implementations§
source§impl<T> FileFormat<T> for Cborwhere
T: Serialize + DeserializeOwned,
impl<T> FileFormat<T> for Cborwhere
T: Serialize + DeserializeOwned,
§type FormatError = CborError
type FormatError = CborError
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>
fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>
Deserialize a value from a
Read
stream. Read moresource§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>
Serialize a value into a
Write
stream. Read moresource§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,
Identical to
FileFormat::from_reader
, however the provided reader is buffered with BufReader
. Read moresource§fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>
Deserialize a value from a byte vec.
source§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,
Identical to
FileFormat::to_writer
, however the provided writer is buffered with BufWriter
. Read moresource§impl PartialEq for Cbor
impl PartialEq for Cbor
impl Copy for Cbor
impl Eq for Cbor
impl StructuralEq for Cbor
impl StructuralPartialEq for Cbor
Auto Trait Implementations§
impl RefUnwindSafe for Cbor
impl Send for Cbor
impl Sync for Cbor
impl Unpin for Cbor
impl UnwindSafe for Cbor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.