Trait keeshond_datapack::DataObject
source · [−]pub trait DataObject {
fn folder_name() -> &'static str
where
Self: Sized;
fn trust_policy() -> TrustPolicy;
fn want_file(pathname: &str) -> bool
where
Self: Sized;
fn from_package_source(
source: &mut Box<dyn Source>,
package_name: &str,
pathname: &str
) -> Result<Self, DataError>
where
Self: Sized;
fn write(
&mut self,
package_name: &str,
pathname: &str,
source: &mut Box<dyn Source>
) -> Result<(), DataError> { ... }
fn generation(&self) -> u64 { ... }
fn set_generation(&mut self, generation: u64) { ... }
}
Expand description
Represents a data item loaded from a package. Implement this trait to allow the system to load new types of data.
Required methods
fn folder_name() -> &'static str where
Self: Sized,
fn folder_name() -> &'static str where
Self: Sized,
The folder name that DataObjects of this type are stored in
fn trust_policy() -> TrustPolicy
fn trust_policy() -> TrustPolicy
The TrustPolicy for this resource type, which determines what sources are allowed to load it.
Determines whether or not a given file should be loaded while iterating through a package.
Provided methods
A function that writes the object to the given Source to save its data
fn generation(&self) -> u64
fn generation(&self) -> u64
Implement this to support “generations” for detecting when the data for a given path is changed.
fn set_generation(&mut self, generation: u64)
fn set_generation(&mut self, generation: u64)
Implement this to support “generations” for detecting when the data for a given path is changed.