pub trait DecodeBorrow<'de>: Sized + 'de {
// Required method
fn decode_borrow(
buf: &mut &'de [u8],
version: i16,
) -> Result<Self, ProtocolError>;
}Expand description
Like Decode, but for the borrowed, zero-copy flavors.
This trait needs a contiguous buffer, because borrowed values reference slices of it.
Required Methods§
Sourcefn decode_borrow(
buf: &mut &'de [u8],
version: i16,
) -> Result<Self, ProtocolError>
fn decode_borrow( buf: &mut &'de [u8], version: i16, ) -> Result<Self, ProtocolError>
§Errors
Returns the underlying protocol error when input is truncated, contains an invalid length or tag, or cannot be encoded for the selected version.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".