[−][src]Trait keeshond_datapack::DataObject
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,
Self: Sized,
The folder name that DataObjects of this type are stored in
fn want_file(pathname: &str) -> bool where
Self: Sized,
Self: Sized,
Determines whether or not a given file should be loaded while iterating through a package.
fn from_io(
reader: Box<dyn ReadSeek>,
full_pathname: &str,
source: &mut Box<dyn Source>
) -> Result<Self, DataError> where
Self: Sized,
reader: Box<dyn ReadSeek>,
full_pathname: &str,
source: &mut Box<dyn Source>
) -> Result<Self, DataError> where
Self: Sized,
A constructor that returns a new DataObject of this type given a Read + Seek object
Provided methods
fn write(
&mut self,
full_pathname: &str,
source: &mut Box<dyn Source>
) -> Result<(), DataError>
&mut self,
full_pathname: &str,
source: &mut Box<dyn Source>
) -> Result<(), DataError>
A function that writes to the given [Write] object to save its data
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)
Implement this to support "generations" for detecting when the data for a given path is changed.