Trait bincode::de::BorrowDecode
source · pub trait BorrowDecode<'de>: Sized {
// Required method
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§
sourcefn 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.
Object Safety§
This trait is not object safe.