Trait LengthLimitedRead

Source
pub trait LengthLimitedRead: Read {
    // Required method
    fn remaining_bytes(&self) -> u64;
}
Expand description

A io::Read that limits the amount of bytes that can be read. Implementations should ensure that the object being read will only consume a fixed number of bytes from the underlying io::Read, see FixedLengthReader for an example.

This is not exported to bindings users as reads are always from byte arrays, never streams, in bindings.

Required Methods§

Source

fn remaining_bytes(&self) -> u64

The number of bytes remaining to be read.

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.

Implementations on Foreign Types§

Source§

impl LengthLimitedRead for &[u8]

Implementors§

Source§

impl<'a, R: Read> LengthLimitedRead for FixedLengthReader<'a, R>

This is not exported to bindings users as reads are always from byte arrays, never streams, in bindings.