use ahash::AHashMap;
use std::sync::OnceLock;
mod build;
mod construct;
mod core;
mod diff;
mod lookup;
mod materialize;
mod mutate;
mod providers;
mod tree;
pub use self::diff::DirectoryDiff;
pub use self::providers::{
ArchiveEntry, ArchiveInfo, DuplicateEntry, DuplicateReport, ExplainReport,
MaterializationAction, MaterializationIssue, MaterializationPlan, VfsProviderRecord,
};
use crate::{LayerIndex, NormalizedPath, SourceMeta, VfsFile};
type MaybeFile<'a> = Option<&'a VfsFile>;
type VFSTuple<'a> = (&'a NormalizedPath, &'a VfsFile);
type VFSFiles = AHashMap<NormalizedPath, VfsFile>;
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct VfsProvider {
pub source: SourceMeta,
pub file: VfsFile,
}
impl VfsProvider {
#[must_use]
pub fn new(source: SourceMeta, file: VfsFile) -> Self {
Self { source, file }
}
}
#[derive(Debug, Clone)]
pub(crate) struct ProviderEntry {
pub(crate) source_index: usize,
pub(crate) provider: VfsProvider,
}
pub struct VFS {
file_map: VFSFiles,
dir_prefix_counts: AHashMap<NormalizedPath, usize>,
pub(crate) providers: AHashMap<NormalizedPath, Vec<ProviderEntry>>,
pub(crate) sources: Vec<SourceMeta>,
layer_index: OnceLock<LayerIndex>,
}
#[cfg(test)]
#[path = "tests/dump_tests.rs"]
mod dump_tests;
#[cfg(test)]
#[path = "tests/loose_tests.rs"]
mod loose_tests;
#[cfg(all(test, feature = "beth-archives"))]
#[path = "tests/tests.rs"]
mod tests;
#[cfg(all(test, feature = "zip"))]
#[path = "tests/zip_tests.rs"]
mod zip_tests;