pub trait BorrowDecode<'de, Context>: Sized {
// Required method
fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>(
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, Context = Context>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.