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_next<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>
where T: Decode<Self>;
fn decode_next_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
where T: Decode<Self>;
fn decode_last<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>
where T: Decode<Self>;
fn decode_last_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
where T: Decode<Self>;
}
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_next<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>where
T: Decode<Self>,
fn decode_next<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>where
T: Decode<Self>,
Decodes a T
and returns an Owned
pointer to it.
Returns Err
if decoding failed.
fn decode_next_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>where
T: Decode<Self>,
fn decode_next_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>where
T: Decode<Self>,
Decodes a slice of T
and returns an Owned
pointer to it.
Returns Err
if decoding failed.
fn decode_last<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>where
T: Decode<Self>,
fn decode_last<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>where
T: Decode<Self>,
Finishes the decoder by decoding a T
.
On success, returns Ok
of an Owned
pointer to the decoded value. Returns Err
if the
decoder did not finish successfully.
fn decode_last_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>where
T: Decode<Self>,
fn decode_last_slice<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>where
T: Decode<Self>,
Finishes the decoder by decoding a slice of T
.
On success, returns Ok
of an Owned
pointer to the decoded slice. Returns Err
if the
decoder did not finish successfully.
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.