pub struct Compat<T>(pub T);
Available on crate feature serde only.
Expand description

Wrapper struct that implements Decode and Encode on any type that implements serde’s DeserializeOwned and Serialize respectively.

This works for most types, but if you’re dealing with borrowed data consider using BorrowCompat instead.

Tuple Fields

0: T

Trait Implementations

Attempt to decode this type with the given BorrowDecode.
Attempt to decode this type with the given Decode.
Encode a given type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.