pub struct IsoParser<E: IsoEnvironment> { /* private fields */ }Expand description
ISO Parser - main entry point for boot discovery
Generic over environment to allow testing without actual filesystem/mounts.
Implementations§
Source§impl<E: IsoEnvironment> IsoParser<E>
impl<E: IsoEnvironment> IsoParser<E>
Sourcepub fn new(env: E) -> Self
pub fn new(env: E) -> Self
Construct a parser bound to the given IsoEnvironment.
Typically OsIsoEnvironment in production; a mock in tests.
Sourcepub async fn scan_directory(
&self,
path: &Path,
) -> Result<Vec<BootEntry>, IsoError>
pub async fn scan_directory( &self, path: &Path, ) -> Result<Vec<BootEntry>, IsoError>
Scan a directory for ISO files and extract boot entries.
The async signature is retained for backwards source-compat
with callers that .await it; the function itself performs no
async work today.
This is the legacy entry point — it discards per-ISO failures.
Prefer IsoParser::scan_directory_with_failures for new
callers that need to surface broken ISOs to the user (#456).
§Errors
Returns IsoError::PathTraversal if path escapes
/ (degenerate), IsoError::Io on a filesystem read failure
during the ISO-file discovery walk, or IsoError::NoBootEntries
when every discovered ISO failed to yield entries (legacy
behavior — preserved for callers that still rely on it).
Sourcepub async fn scan_directory_with_failures(
&self,
path: &Path,
) -> Result<ScanReport, IsoError>
pub async fn scan_directory_with_failures( &self, path: &Path, ) -> Result<ScanReport, IsoError>
Scan a directory for .iso files, mount + parse each one, and
return a ScanReport with both successful entries and
per-file failures.
Unlike IsoParser::scan_directory, this does NOT return
IsoError::NoBootEntries when every on-disk ISO failed to
parse — instead it returns Ok(ScanReport { entries: [], failures: […] }). NoBootEntries is reserved for the stricter
case “the walk found zero .iso files”, which lets the caller
distinguish an empty stick from a stick full of broken ISOs.
(#456)
§Errors
Returns IsoError::PathTraversal if path escapes /,
IsoError::Io on a filesystem read failure during the walk,
or IsoError::NoBootEntries when zero .iso files were
found under path.