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