Skip to main content

load_with

Function load_with 

Source
pub fn load_with<T, E>(
    path: impl AsRef<Path>,
    limits: SaveLimits,
    decode: impl FnOnce(u32, &[u8]) -> Result<T, E>,
) -> Result<T, CodecError<E>>
Expand description

Reads/validates, then calls the game decoder once with its schema and bytes. This is the migration hook: reject unsupported schemas or convert older payloads explicitly. Decoder errors never trigger a write or fallback.