pub struct AssetIdRegistry { /* private fields */ }Expand description
Maps forward-slash relative asset paths to their frozen AssetUUID.
See the module documentation for the lazy-freeze semantics and the engine/editor read/write split.
Implementations§
Source§impl AssetIdRegistry
impl AssetIdRegistry
Sourcepub fn load(project_root: impl Into<PathBuf>) -> AssetIdRegistry
pub fn load(project_root: impl Into<PathBuf>) -> AssetIdRegistry
Loads the registry for project_root.
A missing or unreadable file yields an empty registry (every path
then resolves to its new_v5 default) — fresh projects and the
pre-registry world both behave exactly as before. A malformed file is
logged and treated as empty rather than failing the whole project open.
Sourcepub fn resolve(&self, rel_fwd: &str) -> AssetUUID
pub fn resolve(&self, rel_fwd: &str) -> AssetUUID
Resolves the UUID for a forward-slash relative path: the frozen entry if
one exists, otherwise the default AssetUUID::new_v5(rel).
This is the read primitive used by the index builder, the runtime, and the pack builder.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of frozen entries (assets whose path has diverged from identity).
Sourcepub fn freeze(&mut self, rel_fwd: &str, uuid: AssetUUID)
pub fn freeze(&mut self, rel_fwd: &str, uuid: AssetUUID)
Explicitly freezes rel_fwd’s identity to uuid.
Authoring-only. Rarely needed directly — Self::rename freezes as part
of the move.
Sourcepub fn rename(&mut self, old_rel: &str, new_rel: &str)
pub fn rename(&mut self, old_rel: &str, new_rel: &str)
Moves the identity of old_rel to new_rel, freezing it in the process.
The new path resolves to the same UUID the old path resolved to
(whether it was already frozen or still on its new_v5 default), so every
existing reference keeps pointing at the asset. Authoring-only.
Sourcepub fn remove(&mut self, rel_fwd: &str)
pub fn remove(&mut self, rel_fwd: &str)
Drops any frozen entry for rel_fwd (e.g. after the asset is deleted).
Authoring-only.
Sourcepub fn file_path(&self) -> PathBuf
pub fn file_path(&self) -> PathBuf
Absolute path of the on-disk registry file
(<project_root>/.khora/asset-registry.ron).
Sourcepub fn ensure_file(&self) -> Result<(), Error>
pub fn ensure_file(&self) -> Result<(), Error>
Writes the registry file if it does not exist yet, so a project has a
visible .khora/asset-registry.ron from first open (confirming that
persistence is wired). No-op when the file already exists. Authoring-only.
Sourcepub fn save(&self) -> Result<(), Error>
pub fn save(&self) -> Result<(), Error>
Persists the registry to <project_root>/.khora/asset-registry.ron.
Entries are sorted by UUID for deterministic, merge-friendly output, and
the write is atomic (a sibling *.tmp file is written then renamed
over the target) so a crash mid-write cannot corrupt the catalog.
Authoring-only.
Trait Implementations§
Source§impl Clone for AssetIdRegistry
impl Clone for AssetIdRegistry
Source§fn clone(&self) -> AssetIdRegistry
fn clone(&self) -> AssetIdRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AssetIdRegistry
impl RefUnwindSafe for AssetIdRegistry
impl Send for AssetIdRegistry
impl Sync for AssetIdRegistry
impl Unpin for AssetIdRegistry
impl UnsafeUnpin for AssetIdRegistry
impl UnwindSafe for AssetIdRegistry
Blanket Implementations§
§impl<T> AppLifecycle for Twhere
T: ?Sized,
impl<T> AppLifecycle for Twhere
T: ?Sized,
§fn on_start(&mut self, ctx: &mut dyn AppContext)
fn on_start(&mut self, ctx: &mut dyn AppContext)
update. Apps install their theme / fonts here.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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.