Skip to main content

FileReadHandle

Trait FileReadHandle 

Source
pub trait FileReadHandle: Read + Seek {
    // Required method
    fn len(&self) -> u64;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A handle into a regular file opened read-only via Filesystem::open_file_ro. Implementations are Read + Seek with a known total len; no writes, no allocation, no journal interaction. Every backend (including the immutable ones — ISO 9660 / SquashFS / tar — and the streaming ones if the format permits backward seeks) can implement this.

The handle borrows both the filesystem state and the block device for its full lifetime, mirroring FileHandle.

Required Methods§

Source

fn len(&self) -> u64

Total length of the file in bytes.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether the file is zero bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§