Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct naming and aliases for pixel types used in VFX? #62

Closed
virtualritz opened this issue May 9, 2024 · 2 comments
Closed

Struct naming and aliases for pixel types used in VFX? #62

virtualritz opened this issue May 9, 2024 · 2 comments

Comments

@virtualritz
Copy link

Naming of structs in this crate doesn't follow Rust naming conventions.

I.e. RGB should be Rgb, RGBA should be Rgba.

Type aliases should have the type prefix too. I.e. RGB8 should be RgbU8.

Finally, in visual effects, most image data is f16 or f32. It would be noice to have these as aliases.

The f16 ones would be behind a half feature gate that pulls in the resp. crate.

Available type aliases would then be:

  • RgbU8
  • RgbaU8
  • RgbU16
  • RgbaU16
  • RgbF16
  • RgbaF16
  • RgbF32
  • RgbaF32
@kornelski
Copy link
Owner

In your code you can rename these types with use … as or type, either at the root of your crate or a custom prelude module.

The channel type is generic, so you should be able to use it with f16 already.

Renaming types in this crate would be too disruptive for users, and I don't think it's worth the hassle. RGB is a much more common name used in the industry, which is bigger than Rust, and Rust's convention doesn't improve anything here.

@virtualritz
Copy link
Author

I never understand the "hassle" argument for renames, something that takes a few seconds to do in a modern IDE, if you maintain a dependent crate.

And the versioning in Cargo.toml then makes sure the right rgb crate gets referenced.

I.e. if this was C/C++, fair enough. But in Rust this argument simply does not hold water.

Anyway, you are the maintainer.
As the Brits would say: I hear you. 😉

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

No branches or pull requests

2 participants