pub struct ResourceRegistryRefMut<'a> { /* private fields */ }Expand description
A mutable reference to a resource registry. Automatically saves the registry back to a source
from which it was loaded when an instance of this object is dropped. To prevent saving use
std::mem::forget after you’ve finished working with the mutable reference.
Implementations§
Source§impl ResourceRegistryRefMut<'_>
impl ResourceRegistryRefMut<'_>
Sourcepub fn read_metadata(
&mut self,
path: PathBuf,
) -> Result<RegistryUpdate<ResourceMetadata>, FileError>
pub fn read_metadata( &mut self, path: PathBuf, ) -> Result<RegistryUpdate<ResourceMetadata>, FileError>
Read the metadata from the file at the given path.
Sourcepub fn write_metadata(
&mut self,
uuid: Uuid,
path: PathBuf,
) -> Result<RegistryUpdate<Option<PathBuf>>, FileError>
pub fn write_metadata( &mut self, uuid: Uuid, path: PathBuf, ) -> Result<RegistryUpdate<Option<PathBuf>>, FileError>
Writes the new metadata file for a resource at the given path and registers the resource in the registry.
Sourcepub fn remove_metadata(
&mut self,
path: impl AsRef<Path>,
) -> Result<(), FileError>
pub fn remove_metadata( &mut self, path: impl AsRef<Path>, ) -> Result<(), FileError>
Unregisters the resource at the given path (if any) from the registry and deletes its associated metadata file.
Sourcepub fn register(
&mut self,
uuid: Uuid,
path: PathBuf,
) -> RegistryUpdate<Option<PathBuf>>
pub fn register( &mut self, uuid: Uuid, path: PathBuf, ) -> RegistryUpdate<Option<PathBuf>>
Registers a new pair UUID -> Path, and returns the former path for this UUID.
Sourcepub fn unregister(&mut self, uuid: Uuid) -> Option<PathBuf>
pub fn unregister(&mut self, uuid: Uuid) -> Option<PathBuf>
Unregisters a resource path with the given UUID, and returns the former path for the Uuid, if it was registered.
Sourcepub fn unregister_path(&mut self, path: impl AsRef<Path>) -> Option<Uuid>
pub fn unregister_path(&mut self, path: impl AsRef<Path>) -> Option<Uuid>
Unregisters a resource path, and returns the UUID if the given path was previously registered.
Sourcepub fn set_container(&mut self, registry_container: RegistryContainer)
pub fn set_container(&mut self, registry_container: RegistryContainer)
Completely replaces the internal storage.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ResourceRegistryRefMut<'a>
impl<'a> !RefUnwindSafe for ResourceRegistryRefMut<'a>
impl<'a> Send for ResourceRegistryRefMut<'a>
impl<'a> Sync for ResourceRegistryRefMut<'a>
impl<'a> Unpin for ResourceRegistryRefMut<'a>
impl<'a> UnsafeUnpin for ResourceRegistryRefMut<'a>
impl<'a> !UnwindSafe for ResourceRegistryRefMut<'a>
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.