Trait bincode::de::BorrowDecode
source · [−]pub trait BorrowDecode<'de>: Sized {
fn borrow_decode<D: BorrowDecoder<'de>>(
decoder: &mut D
) -> Result<Self, DecodeError>;
}
Expand description
Trait that makes a type able to be decoded, akin to serde’s Deserialize
trait.
This trait should be implemented for types that contain borrowed data, like &str
and &[u8]
. If your type does not have borrowed data, consider implementing Decode instead.
This trait will be automatically implemented if you enable the derive
feature and add #[derive(bincode::Decode)]
to a type with a lifetime.
Required methods
fn borrow_decode<D: BorrowDecoder<'de>>(
decoder: &mut D
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de>>(
decoder: &mut D
) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Implementations on Foreign Types
Implementors
impl<'de, T> BorrowDecode<'de> for BorrowCompat<T> where
T: Deserialize<'de>,
This is supported on crate feature
serde
only.