Trait std::sys::unix::kernel_copy::CopyRead[][src]

trait CopyRead: Read {
    fn properties(&self) -> CopyParams;

    fn drain_to<W: Write>(
        &mut self,
        _writer: &mut W,
        _limit: u64
    ) -> Result<u64> { ... }
fn taken(&mut self, _bytes: u64) { ... }
fn min_limit(&self) -> u64 { ... } }
This is supported on Linux or Android only.

Required methods

Extracts the file descriptor and hints/metadata, delegating through wrappers if necessary.

Provided methods

Implementations that contain buffers (i.e. BufReader) must transfer data from their internal buffers into writer until either the buffers are emptied or limit bytes have been transferred, whichever occurs sooner. If nested buffers are present the outer buffers must be drained first.

This is necessary to directly bypass the wrapper types while preserving the data order when operating directly on the underlying file descriptors.

Updates Take wrappers to remove the number of bytes copied.

The minimum of the limit of all Take<_> wrappers, u64::MAX otherwise. This method does not account for data BufReader buffers and would underreport the limit of a Take<BufReader<Take<_>>> type. Thus its result is only valid after draining the buffers via drain_to.

Implementors