use bevy_ecs::prelude::World;
use std::path::Path;
use crate::bevy_registry::{SnapshotRegistry, IDRemapRegistry, EntityRemapper};
pub trait Archive: Sized {
fn create(
world: &World,
registry: &SnapshotRegistry,
) -> Result<Self, Box<dyn std::error::Error + Send + Sync>>;
fn apply(
&self,
world: &mut World,
registry: &SnapshotRegistry,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
fn apply_with_remap(
&self,
_world: &mut World,
_registry: &SnapshotRegistry,
_id_registry: &IDRemapRegistry,
_mapper: &dyn EntityRemapper,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Err("Remapping not implemented for this archive format".into())
}
fn save_to(
&self,
path: impl AsRef<Path>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
fn load_from(
path: impl AsRef<Path>,
) -> Result<Self, Box<dyn std::error::Error + Send + Sync>>;
fn get_entities(&self) -> Vec<u32> {
vec![]
}
fn load_resources(
&self,
_world: &mut World,
_registry: &SnapshotRegistry,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
}