Trait ReadRangeExt

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

Extension trait for reading types whose config is (RangeConfig, T) where T is a unit type (a type of one possible value, such as () or ((), ())).

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

Provided Methods§

Source

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

Reads a value using only a range configuration. Assumes the inner configuration is a unit type.

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: Read<(R, ((), ()))>> ReadRangeExt<((), ()), R> for U

Source§

impl<R: RangeConfig, U: Read<(R, ())>> ReadRangeExt<(), R> for U