Skip to main content

RandomAccessRead

Trait RandomAccessRead 

Source
pub trait RandomAccessRead: Send + Sync {
    // Required methods
    fn len(&self) -> u64;
    fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize, Error>;

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

Random-access byte source for opening a crate::Package without copying the entire ZIP archive into memory (for example, backed by a browser Blob/File.slice() or OPFS FileSystemSyncAccessHandle).

Required Methods§

Source

fn len(&self) -> u64

Total byte length of the source.

Source

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize, Error>

Reads bytes starting at offset into buf, returning the number of bytes read (0 at EOF).

§Errors

Returns an I/O error if reading from the underlying storage fails.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true when the source has zero bytes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§