Skip to main content

SceneMigration

Trait SceneMigration 

pub trait SceneMigration: Send + Sync {
    // Required methods
    fn from_version(&self) -> u32;
    fn to_version(&self) -> u32;
    fn migrate(&self, payload: &[u8]) -> Result<Vec<u8>, MigrationError>;
}
Expand description

One step of a scene-format migration. Receives the raw payload bytes emitted by the previous version’s strategy and returns the bytes the next version’s strategy expects.

Required Methods§

fn from_version(&self) -> u32

Source format version (matches SceneHeader.format_version).

fn to_version(&self) -> u32

Target format version produced by this migration.

fn migrate(&self, payload: &[u8]) -> Result<Vec<u8>, MigrationError>

Apply the migration. Implementations should be pure (no side effects) and self-contained — they run before the world is touched.

Implementors§