New for Rgb undefined?

Ref: https://play.rust-lang.org/

Documentation says that, to create a Rgb pixel from numerical values, the old from_channels is deprecated. The compiler agrees. It's supposedly been replaced by new. But "new" doesn't work, and there's no sign of it in the code near from_channels. Did that get left out?

This is a link to the playground in general, not to the specific example. You might want to click "Share" button at the top right copy the generated link from there.

This is a mistake in documentation - Rgba (and Rgb) doesn't define any new method indeed, but it is not necessary, since their only field is public. Therefore, just Rgb([r, g, b]) should work.

1 Like

Oops.