DecodeRangeExt

Trait DecodeRangeExt 

Source
pub trait DecodeRangeExt<X: Default>: Decode<Cfg = (RangeCfg, X)> {
    // Provided method
    fn decode_range(
        buf: impl Buf,
        range: impl Into<RangeCfg>,
    ) -> Result<Self, Error> { ... }
}
Expand description

Extension trait for reading types whose config is (RangeCfg, X) where X is Default, ensuring the buffer is consumed.

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

Provided Methods§

Source

fn decode_range( buf: impl Buf, range: impl Into<RangeCfg>, ) -> Result<Self, Error>

Decodes a value using only a range configuration.

The inner configuration type X must be Default and X::default() is used for it.

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<X: Default, U: Decode<Cfg = (RangeCfg, X)>> DecodeRangeExt<X> for U