[−][src]Struct futures_cbor_codec::Encoder
CBOR based encoder.
This encoder can be used with future_codec
's FramedWrite
to encode CBOR frames. Anything
that is serde
s Serialize
can be encoded this way (at least in theory, some values return
errors when attempted to serialize).
Methods
impl<Item: Serialize> Encoder<Item>
[src]
pub fn new() -> Self
[src]
Creates a new encoder.
By default, it doesn't do packed encoding (it includes struct field names) and it doesn't prefix the frames with self-describe tag.
pub fn sd(self, sd: SdMode) -> Self
[src]
Turns the encoder into one with configured self-describe behaviour.
pub fn packed(self, packed: bool) -> Self
[src]
Turns the encoder into one with configured packed encoding.
If packed
is true, it omits the field names from the encoded data. That makes it smaller,
but it also means the decoding end must know the exact order of fields and it can't be
something like python, which would want to get a dictionary out of it.
Trait Implementations
impl<Item: Clone> Clone for Encoder<Item>
[src]
impl<Item: Serialize> Default for Encoder<Item>
[src]
impl<Item: Debug> Debug for Encoder<Item>
[src]
impl<Item: Serialize> Encoder for Encoder<Item>
[src]
Auto Trait Implementations
impl<Item> Send for Encoder<Item>
impl<Item> Sync for Encoder<Item>
impl<Item> Unpin for Encoder<Item>
impl<Item> UnwindSafe for Encoder<Item>
impl<Item> RefUnwindSafe for Encoder<Item>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,