Skip to content

feat: re-export rgb::prelude for trait access#4

Merged
kornelski merged 1 commit intokornelski:mainfrom
lilith:rgb-0.8.91-compat
Jan 19, 2026
Merged

feat: re-export rgb::prelude for trait access#4
kornelski merged 1 commit intokornelski:mainfrom
lilith:rgb-0.8.91-compat

Conversation

@lilith
Copy link
Copy Markdown
Contributor

@lilith lilith commented Jan 19, 2026

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::RGB or yuv::RGBA types, calling .map() requires the Pixel trait (or ComponentMap in 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 from ComponentMap to Pixel.

Solution

Re-export rgb::prelude so users can:

use yuv::prelude::*;
let half = pixel.map(|c| c / 2);

The prelude approach is forward-compatible - it works with both rgb 0.8.x (exports ComponentMap) and rgb 0.8.91+ (exports Pixel).

Related

This helps downstream crates like aom-decode which use yuv::RGB types with .map().

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.
@kornelski kornelski merged commit e5ad851 into kornelski:main Jan 19, 2026
@kornelski
Copy link
Copy Markdown
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants