interface (WIP)
Typed, lossy-aware interface translation between API versions.
Overview
interface models data migration between versioned API schemas. Each
conversion is a [Translation<Source, Target, Lossiness>] — a deferred,
inspectable value that carries a [Diff] and encodes at the type level
whether the conversion is information-preserving ([Lossless]) or
destructive ([Lossy]).
Usage
Implement Upgrade / Downgrade
use ;
Execute a translation
// Lossless: `.translate()` is only available on `Translation<_, _, Lossless>`
let t = User .upgrade;
assert!;
let v2_user = t.translate;
// Lossy: must call `.translate_lossy()` — the distinct method name forces acknowledgement
let t = v2_user.downgrade;
assert!;
println!; // prints the diff
let v1_user = t.translate_lossy;
License
MIT