Skip to main content

ArchiveStorage

Trait ArchiveStorage 

Source
pub trait ArchiveStorage {
    // Required methods
    fn read_file(&mut self, path: &str) -> Result<Vec<u8>>;
    fn write_file(&mut self, path: &str, data: &[u8]) -> Result<()>;
    fn file_exists(&self, path: &str) -> bool;
    fn file_names(&self) -> Vec<String>;
}
Expand description

Trait for archive storage backends.

This trait abstracts over the underlying storage mechanism (ZIP files, in-memory storage, etc.) to enable unit testing and support alternative backends.

Required Methods§

Source

fn read_file(&mut self, path: &str) -> Result<Vec<u8>>

Read a file from the archive.

§Errors

Returns an error if the file doesn’t exist or cannot be read.

Source

fn write_file(&mut self, path: &str, data: &[u8]) -> Result<()>

Write a file to the archive.

§Errors

Returns an error if the file cannot be written.

Source

fn file_exists(&self, path: &str) -> bool

Check if a file exists in the archive.

Source

fn file_names(&self) -> Vec<String>

Get all file names in the archive.

Implementors§