Replace numeric version field with Format enum#805
Merged
Conversation
SensorLock
approved these changes
May 21, 2026
Header and Image now carry a Format (Lime / AvmlCompressed) instead of
a u32 version. The wire encoding (4-byte magic + 4-byte version) is
unchanged, so on-disk .lime / .avml files read back identically.
API changes:
- image::Format enum, re-exported from the crate root
- Header { format } and Snapshot::format(Format) replace the integer
version field/builder
- Image fields format and align_src are now pub(crate); src/dst remain
pub for the convert binary's stream manipulation. Image::from_streams
is the public constructor for non-file usage
- Header::encode is infallible; Header::write no longer propagates a
version error
- Error::UnimplementedVersion is removed (UnsupportedFormat covers
bad-magic / wrong-version pairs from disk)
- avml-convert renames its CLI value-enum to CliFormat to avoid
collision with image::Format
Every format dispatch site (copy_if_nonzero, convert_block,
convert_to_raw_image) is now exhaustive on the two variants.
6fd02a5 to
cc6e35d
Compare
SensorLock
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the bare
u32version field onHeaderandImagewith animage::Formatenum (Lime/AvmlCompressed).The wire encoding (4-byte magic + 4-byte version) is unchanged, so existing
.lime/.avmlfiles read back identically.API changes
image::Formatenum, re-exported from the crate root.Header { format }andSnapshot::format(Format)replace the integerversionfield / builder.Imagefieldsformatandalign_srcare nowpub(crate);src/dstremainpubfor the convert binary's stream manipulation.Image::from_streamsis the public constructor for non-file usage.Header::encodeis infallible;Header::writeno longer propagates a version error.Error::UnimplementedVersionis removed —UnsupportedFormatcovers bad-magic / wrong-version pairs read from disk.avml-convertrenames its CLI value-enum toCliFormatto avoid collision withimage::Format.Why
Every format dispatch site (
copy_if_nonzero,convert_block,convert_to_raw_image) is now exhaustive on the two variants — adding a v3 will force an update at each site instead of falling through an_ => Err(UnimplementedVersion)arm. Constructing anImagewith an invalid version is no longer expressible.Verified locally
cargo fmtcargo clippy --locked --all-targets --all-features -- -D warnings -D clippy::pedantic -A clippy::missing_errors_doccargo test --all-features(28 lib + 2 convert + 1 doctest pass)