pub struct ResourceMetadata {
pub resource_id: Uuid,
}Expand description
Resource metadata contains additional information that cannot be stored in the resource file itself. The most important bit of information is a resource uuid, this id is used to as reference that does not change when the resource moved or renamed.
Fields§
§resource_id: UuidA resource uuid, this id is used to as reference that does not change when the resource moved or renamed.
Implementations§
Source§impl ResourceMetadata
impl ResourceMetadata
Sourcepub fn new_with_random_id() -> Self
pub fn new_with_random_id() -> Self
Creates a new metadata with random uuid.
Sourcepub async fn load_from_file_async(
path: &Path,
resource_io: &dyn ResourceIo,
) -> Result<Self, FileError>
pub async fn load_from_file_async( path: &Path, resource_io: &dyn ResourceIo, ) -> Result<Self, FileError>
Tries to load a metadata from the given path.
Sourcepub async fn save_async(
&self,
path: &Path,
resource_io: &dyn ResourceIo,
) -> Result<(), FileError>
pub async fn save_async( &self, path: &Path, resource_io: &dyn ResourceIo, ) -> Result<(), FileError>
Tries to write the metadata to the given path. This method is meant to be used in async
context. For sync version use Self::save_sync.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ResourceMetadata
impl<'de> Deserialize<'de> for ResourceMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ResourceMetadata
impl RefUnwindSafe for ResourceMetadata
impl Send for ResourceMetadata
impl Sync for ResourceMetadata
impl Unpin for ResourceMetadata
impl UnsafeUnpin for ResourceMetadata
impl UnwindSafe for ResourceMetadata
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.