pub trait RegistryContainerExt: Sized {
// Required methods
fn serialize_to_string(&self) -> Result<String, FileError>;
async fn load_from_file(
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<Self, FileError>;
async fn save(
&self,
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<(), FileError>;
fn save_sync(
&self,
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<(), FileError>;
}Expand description
An extension trait with save/load methods.
Required Methods§
Sourcefn serialize_to_string(&self) -> Result<String, FileError>
fn serialize_to_string(&self) -> Result<String, FileError>
Serializes the registry into a formatted string.
Sourceasync fn load_from_file(
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<Self, FileError>
async fn load_from_file( path: &Path, resource_io: &(dyn ResourceIo + 'static), ) -> Result<Self, FileError>
Tries to load a registry from a file using the specified resource IO. This method is intended to be used only in async contexts.
Sourceasync fn save(
&self,
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<(), FileError>
async fn save( &self, path: &Path, resource_io: &(dyn ResourceIo + 'static), ) -> Result<(), FileError>
Tries to save the registry into a file using the specified resource IO. This method is intended to be used only in async contexts.
Sourcefn save_sync(
&self,
path: &Path,
resource_io: &(dyn ResourceIo + 'static),
) -> Result<(), FileError>
fn save_sync( &self, path: &Path, resource_io: &(dyn ResourceIo + 'static), ) -> Result<(), FileError>
Same as Self::save, but synchronous.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.