ReadRangeExt

Trait ReadRangeExt 

Source
pub trait ReadRangeExt<X: Default>: Read<Cfg = (RangeCfg, X)> {
    // Provided method
    fn read_range(
        buf: &mut 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.

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

Provided Methods§

Source

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

Reads 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: Read<Cfg = (RangeCfg, X)>> ReadRangeExt<X> for U