pub struct IndexBuilder<'a> { /* private fields */ }Expand description
Recursive scanner that turns a project’s assets/ directory into an
AssetMetadata list ready for the VFS.
See module documentation for determinism and UUID stability guarantees.
Implementations§
Source§impl<'a> IndexBuilder<'a>
impl<'a> IndexBuilder<'a>
Sourcepub fn new(assets_root: &'a Path) -> Self
pub fn new(assets_root: &'a Path) -> Self
Creates a new builder rooted at assets_root.
assets_root must be the assets directory of a project, not the
project root — the relative paths recorded in AssetMetadata (and
hence the UUIDs) are computed relative to it.
Without Self::with_registry, UUIDs are the path-derived
new_v5 default (the pre-registry behaviour).
Sourcepub fn with_registry(self, registry: &'a AssetIdRegistry) -> Self
pub fn with_registry(self, registry: &'a AssetIdRegistry) -> Self
Resolves each asset’s UUID through registry (frozen identities win;
unfrozen paths still fall back to new_v5). Supply the same registry in
dev (editor VFS) and release (pack builder) so UUIDs match by
construction.
Sourcepub fn build_metadata(&self) -> Result<Vec<AssetMetadata>>
pub fn build_metadata(&self) -> Result<Vec<AssetMetadata>>
Walks the assets root and produces a sorted, deterministic
Vec<AssetMetadata>.
Returns an empty vector if assets_root doesn’t exist — the editor
tolerates fresh projects whose assets/ directory hasn’t been
populated yet.
Sourcepub fn build_index_bytes(&self) -> Result<Vec<u8>>
pub fn build_index_bytes(&self) -> Result<Vec<u8>>
Convenience: builds metadata and bincode-encodes it into the byte
vector that crate::vfs::VirtualFileSystem::new expects.
Auto Trait Implementations§
impl<'a> Freeze for IndexBuilder<'a>
impl<'a> RefUnwindSafe for IndexBuilder<'a>
impl<'a> Send for IndexBuilder<'a>
impl<'a> Sync for IndexBuilder<'a>
impl<'a> Unpin for IndexBuilder<'a>
impl<'a> UnsafeUnpin for IndexBuilder<'a>
impl<'a> UnwindSafe for IndexBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more