FileRead

Trait FileRead 

Source
pub trait FileRead {
Show 15 methods // Required methods fn pkgname(&self) -> &str; fn comment(&self) -> Result<String>; fn contents(&self) -> Result<String>; fn desc(&self) -> Result<String>; fn build_info(&self) -> Result<Option<String>>; fn build_version(&self) -> Result<Option<String>>; fn deinstall(&self) -> Result<Option<String>>; fn display(&self) -> Result<Option<String>>; fn install(&self) -> Result<Option<String>>; fn installed_info(&self) -> Result<Option<String>>; fn mtree_dirs(&self) -> Result<Option<String>>; fn preserve(&self) -> Result<Option<String>>; fn required_by(&self) -> Result<Option<String>>; fn size_all(&self) -> Result<Option<String>>; fn size_pkg(&self) -> Result<Option<String>>;
}
Expand description

Trait for types that provide package metadata.

This trait abstracts over different package sources (binary archives, installed packages) providing a unified interface for accessing metadata.

§Return Types

  • Required metadata (comment, contents, desc) returns io::Result<String> since these files must exist for a valid package.

  • Optional metadata returns io::Result<Option<String>>:

    • Ok(Some(content)) - File exists and was read successfully
    • Ok(None) - File does not exist (this is normal for optional metadata)
    • Err(e) - An I/O error occurred (permission denied, disk failure, etc.)

This design ensures that real I/O errors are propagated to callers rather than being silently swallowed as “file not found”.

Required Methods§

Source

fn pkgname(&self) -> &str

Package name including version (e.g., “foo-1.0”).

Source

fn comment(&self) -> Result<String>

Package comment (+COMMENT). Single line description.

Source

fn contents(&self) -> Result<String>

Package contents (+CONTENTS). The packing list.

Source

fn desc(&self) -> Result<String>

Package description (+DESC). Multi-line description.

Source

fn build_info(&self) -> Result<Option<String>>

Build information (+BUILD_INFO).

Source

fn build_version(&self) -> Result<Option<String>>

Build version (+BUILD_VERSION).

Source

fn deinstall(&self) -> Result<Option<String>>

Deinstall script (+DEINSTALL).

Source

fn display(&self) -> Result<Option<String>>

Display file (+DISPLAY).

Source

fn install(&self) -> Result<Option<String>>

Install script (+INSTALL).

Source

fn installed_info(&self) -> Result<Option<String>>

Installed info (+INSTALLED_INFO).

Source

fn mtree_dirs(&self) -> Result<Option<String>>

Mtree dirs (+MTREE_DIRS).

Source

fn preserve(&self) -> Result<Option<String>>

Preserve file (+PRESERVE).

Source

fn required_by(&self) -> Result<Option<String>>

Required by (+REQUIRED_BY).

Source

fn size_all(&self) -> Result<Option<String>>

Total size including dependencies (+SIZE_ALL).

Source

fn size_pkg(&self) -> Result<Option<String>>

Package size (+SIZE_PKG).

Implementors§