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) returnsio::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 successfullyOk(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§
Sourcefn build_info(&self) -> Result<Option<String>>
fn build_info(&self) -> Result<Option<String>>
Build information (+BUILD_INFO).
Sourcefn build_version(&self) -> Result<Option<String>>
fn build_version(&self) -> Result<Option<String>>
Build version (+BUILD_VERSION).
Sourcefn installed_info(&self) -> Result<Option<String>>
fn installed_info(&self) -> Result<Option<String>>
Installed info (+INSTALLED_INFO).
Sourcefn mtree_dirs(&self) -> Result<Option<String>>
fn mtree_dirs(&self) -> Result<Option<String>>
Mtree dirs (+MTREE_DIRS).
Sourcefn required_by(&self) -> Result<Option<String>>
fn required_by(&self) -> Result<Option<String>>
Required by (+REQUIRED_BY).