fix: add backward-compatible methods to Gray_v08 and GrayAlpha_v08#149
fix: add backward-compatible methods to Gray_v08 and GrayAlpha_v08#149lilith wants to merge 2 commits intokornelski:mainfrom
Conversation
|
Let's wait on adding them until I complete further testing. Turns out some of those baseline failures were actually a bug, and more crates remain affected |
|
I got a chance to go more carefully through every dependent. I think this should allow publication of the transitional 0.8 release with a low chance of breakage. Only @kornelski really used the deeper parts of this crate in a way that was sensitive to the changes. |
d36fca7 to
23a15a6
Compare
Adds backward-compatible methods for dependent crates during v0.8 → v1.0 migration: Gray_v08: - value() - reads .0 field - value_mut() - mutable access to .0 field - with_alpha() - creates GrayAlpha_v08 GrayAlpha_v08: - value_mut() - mutable access to .0 field - DerefMut impl - allows mutable .v/.a access All methods marked #[deprecated] to encourage migration to Gray_v09/GrayA. Tested with cargo-copter against 224 dependents: 95% pass rate. Regressions are version conflicts that auto-resolve when 0.8.91 is stable.
23a15a6 to
46695fd
Compare
|
Deref_mut didn't want to allow it
…On Mon, Jan 19, 2026, 10:36 AM ripytide ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/formats/gray_alpha.rs
<#149 (comment)>:
> @@ -34,13 +34,31 @@ impl<T, A> Deref for GrayAlpha_v08<T, A> {
}
}
+impl<T, A> DerefMut for GrayAlpha_v08<T, A> {
+ /// Compatibility shim - allows mutable access to `.v` and `.a` on the old `GrayAlpha` type.
+ ///
+ /// **Deprecated:** Migrate to `GrayA` instead of `GrayAlpha_v08`.
+ fn deref_mut(&mut self) -> &mut GrayA<T, A> {
This one is not deprecated? Seems odd.
—
Reply to this email directly, view it on GitHub
<#149 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2LHYNYFD4KEGG42STVVT4HUI2HAVCNFSM6AAAAACQC4BC46VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNZZGEYDONJTHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Okay, so load_image could actually fix everything in the ecosystem except for the resize crate, which this PR solves (as well as fixing any closed-source or not-on-crates.io crates). I can't fork on codeberg, but the changes are here (which will make it compatible with this version as well as the previous 0.8. lilith/load_image@rgb-prelude-export...fix-rgb-0.8.91-compat Here's what I think we should do in order
|
Summary
Adds missing methods to legacy Gray types to maintain backward compatibility with dependent crates during the v0.8 → v0.9 → v1.0 migration.
Problem
Several crates broke when upgrading to rgb 0.8.90+ due to missing methods on
Gray_v08andGrayAlpha_v08:no method named 'value_mut'Gray.value_mut()cannot assign to data in dereferenceGrayAlpha: DerefMutGrayAlpha: DerefMutGrayAlpha: DerefMutChanges
src/formats/gray.rs- Added toGray_v08:src/formats/gray_alpha.rs- Added toGrayAlpha_v08:Safety
The
DerefMutimpl is sound because:GrayAlpha_v08<T, A>(tuple:(T, A)) andGrayA<T, A>(struct:{ v: T, a: A }) are#[repr(C)]Testing
Tested with cargo-copter against 224 top rgb dependents:
Regression Analysis
Of the 8 regressions found, most are artifacts of forcing a pre-release version and will auto-resolve when 0.8.91 is released as stable:
IsTransparentPixeltrait fixKey finding: All affected crates already use flexible version constraints (
^0.8or^0.8.x) that accept 0.8.91. The regressions in testing were caused by forcing a pre-release version while transitive dependencies resolved to 0.8.52 (latest stable), creating type mismatches.Notable Successes
Major crates working with 0.8.91: image, resvg, oxipng, gifski, femtovg, dssim, butteraugli, mozjpeg, lodepng, imagequant, fast_image_resize, ravif, jpegli-rs
Related
.0→.value()→.v🤖 Generated with Claude Code