Trait DecodeRangeExt

Source
pub trait DecodeRangeExt<T: Config + Default, R: RangeConfig>: Decode<(R, T)> {
    // Provided method
    fn decode_range(buf: impl Buf, range: R) -> Result<Self, Error> { ... }
}
Expand description

Extension trait for decoding types whose config is (RangeConfig, T), i.e., requiring a range but no specific inner configuration, ensuring the buffer is consumed.

Useful for decoding collections like Vec<T> where T implements Read<()>. Import this trait to use the .decode_range() method.

Provided Methods§

Source

fn decode_range(buf: impl Buf, range: R) -> Result<Self, 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.

Implementors§

Source§

impl<R: RangeConfig, U: Decode<(R, ((), ()))>> DecodeRangeExt<((), ()), R> for U

Source§

impl<R: RangeConfig, U: Decode<(R, ())>> DecodeRangeExt<(), R> for U