Struct yy_boss::YyResourceHandler [−][src]
pub struct YyResourceHandler<T: YyResource> { /* fields omitted */ }
Implementations
Returns an immutable reference to a resource’s data, if it exists.
Since associated data is lazily loaded, and be unloaded at any time,
there may not be any associated data returned. You can request that data to be
loaded using load_resource_associated_data
.
Returns an mutable reference to a resource’s data, if it exists.
Since associated data is lazily loaded, and be unloaded at any time,
there may not be any associated data returned. You can request that data to be
loaded using load_resource_associated_data
.
Safety
This function is VERY UNSAFE, but not in a memory sense. The entire purpose of this library is, in effect, to shield the user from making changes to the Yyp database which require side effects. How could a user know which effects to use and what to not use? They absolutely cannot. Unless you are very certain that the change you are making will not impact anything outside that file, do not use this function.
Additionally, be aware that mutating data does not guarentee serialization: please use force_serialize
.
Attempts to mark a resource for serialization, and returns if it was succesfully marked.
pub fn load_resource_associated_data(
&mut self,
resource_name: &str,
root: &Path,
tcu: &TrailingCommaUtility
) -> Result<&T::AssociatedData, YyResourceHandlerError>
pub fn load_resource_associated_data(
&mut self,
resource_name: &str,
root: &Path,
tcu: &TrailingCommaUtility
) -> Result<&T::AssociatedData, YyResourceHandlerError>
Loads in the associated data of a given resource name, if that resource exists and is managed.
If that resource already has some associated data, it will be discarded, and the new data will be loaded. If the resource does not exist or is not of the type that this manager handles, an error will be returned.
pub fn unload_resource_associated_data(
&mut self,
resource_name: &str
) -> Result<(), YyResourceHandlerError>
pub fn unload_resource_associated_data(
&mut self,
resource_name: &str
) -> Result<(), YyResourceHandlerError>
Unloads a resource. This will free up some memory.
If the resource does not exist on this handler, an error will be returned.
Trait Implementations
type Item = &'a YyResourceData<T>
type Item = &'a YyResourceData<T>
The type of the elements being iterated over.
type IntoIter = Values<'a, String, YyResourceData<T>>
type IntoIter = Values<'a, String, YyResourceData<T>>
Which kind of iterator are we turning this into?
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.