kornelski / rust-rgb

struct RGB for sharing pixels between crates
https://lib.rs/rgb
MIT License
97 stars 19 forks source link

Add a prelude #121

Closed ripytide closed 1 month ago

ripytide commented 1 month ago

From #64:

Add prelude::*? There's a bunch of traits.

A question here might be what goes into the prelude? Just the traits, or traits and pixels, or everything? If everything then could we get away with rgb::* as all items are exported from the top-level (depending on the errors module being discussed in #118).

kornelski commented 1 month ago

Probably just traits, as otherwise it's too close to rgb::*. My thinking is that importing all traits would help migrate between versions, because you'll get the methods regardless of where they come from.

Another thing is that there's a trade-off between having one trait that contains all the methods (simple to import, easy to browse in docs), vs having many small traits with just the relevant methods. Importing almost a trait per method is burdensome. Wildcard import helps to hide the trait split a bit.

ripytide commented 1 month ago

Sounds good to me :+1: