Trait DecoderExt
pub trait DecoderExt {
// Required methods
fn take_chunks<'de>(
self: &mut &'de mut Self,
count: usize,
) -> Result<&'de mut [WireU64], DecodeError>;
fn take_slot<'de, T>(
self: &mut &'de mut Self,
) -> Result<Slot<'de, T>, DecodeError>;
fn take_slice_slot<'de, T>(
self: &mut &'de mut Self,
len: usize,
) -> Result<Slot<'de, [T]>, DecodeError>;
fn decode_owned<'de, T>(
self: &mut &'de mut Self,
) -> Result<<T as Wire>::Decoded<'de>, DecodeError>
where T: Decode<Self>;
fn decode<T>(self) -> Result<Decoded<T, Self>, DecodeError>
where T: Decode<Self>,
Self: Sized;
}
Expand description
Extension methods for Decoder
.
Required Methods§
fn take_chunks<'de>(
self: &mut &'de mut Self,
count: usize,
) -> Result<&'de mut [WireU64], DecodeError>
fn take_chunks<'de>( self: &mut &'de mut Self, count: usize, ) -> Result<&'de mut [WireU64], DecodeError>
Takes a slice of Chunk
s from the decoder.
fn take_slot<'de, T>(
self: &mut &'de mut Self,
) -> Result<Slot<'de, T>, DecodeError>
fn take_slot<'de, T>( self: &mut &'de mut Self, ) -> Result<Slot<'de, T>, DecodeError>
Takes enough chunks for a T
, returning a Slot
of the taken value.
fn take_slice_slot<'de, T>(
self: &mut &'de mut Self,
len: usize,
) -> Result<Slot<'de, [T]>, DecodeError>
fn take_slice_slot<'de, T>( self: &mut &'de mut Self, len: usize, ) -> Result<Slot<'de, [T]>, DecodeError>
Takes enough chunks for a slice of T
, returning a Slot
of the taken slice.
fn decode_owned<'de, T>(
self: &mut &'de mut Self,
) -> Result<<T as Wire>::Decoded<'de>, DecodeError>where
T: Decode<Self>,
fn decode_owned<'de, T>(
self: &mut &'de mut Self,
) -> Result<<T as Wire>::Decoded<'de>, DecodeError>where
T: Decode<Self>,
Decodes an Owned
value from the decoder without finishing it.
On success, returns Ok
of an Owned
value. Returns Err
if decoding failed.
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.