feat: re-export rgb::prelude for trait access#4
Merged
kornelski merged 1 commit intokornelski:mainfrom Jan 19, 2026
Merged
Conversation
Re-exports the rgb crate's prelude module so that users of yuv can access traits like `Pixel` (which provides the `.map()` method) without needing to add rgb as a direct dependency. This enables code like: ```rust use yuv::prelude::*; let half = pixel.map(|c| c / 2); ``` The prelude re-export works with both rgb 0.8.x and upcoming 0.8.91+, providing forward compatibility as the rgb crate transitions its trait system.
Owner
|
Thanks |
This was referenced Jan 19, 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.
Summary
Re-exports the rgb crate's prelude module so that users of yuv can access traits like
Pixel(which provides the.map()method) without needing to add rgb as a direct dependency.Problem
When using
yuv::RGBoryuv::RGBAtypes, calling.map()requires thePixeltrait (orComponentMapin older versions) to be in scope. Currently, users need to add rgb as a dependency and import the trait themselves.This becomes a breaking change issue when rgb 0.8.91 is released, as the trait providing
.map()changes fromComponentMaptoPixel.Solution
Re-export
rgb::preludeso users can:The prelude approach is forward-compatible - it works with both rgb 0.8.x (exports
ComponentMap) and rgb 0.8.91+ (exportsPixel).Related
This helps downstream crates like
aom-decodewhich useyuv::RGBtypes with.map().