Running with Rust 1.77.2 on Windows 10, I ran this code :
let color = [r, g, b];
let color = prisma::Rgb::new(color[0], color[1], color[2]);
let mut color = prisma::Hsv::<f32,angular_units::Deg<_>>::from_color(&color);
color.set_hue( color.hue() + angular_units::Deg(90.0) );
let color = prisma::Rgb::from_color(&color);
let color = [color.red(), color.green(), color.blue()];
In other words, I created a color from existing r,g,b values and then attempted to rotate its hue 90 degrees.
On the line let color = prisma::Rgb::from_color(&color); I got:
thread 'main' panicked at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:29
1:18:
internal error: entered unreachable code
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library\std\src\panicking.rs:647
1: core::panicking::panic_fmt
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library\core\src\panicking.rs:72
2: core::panicking::panic
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library\core\src\panicking.rs:144
3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291 3: prisma::hsv::impl$15::from_color<f32,angular_units::Deg<f32> >
at C:\Users\Andi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\prisma-0.1.1\src\hsv.rs:291
4: video::main
at .\src\main.rs:188
5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04\library\core\src\ops\function.rs:250
6: core::hint::black_box
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04\library\core\src\hint.rs:334
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
It would be reasonable to expect that "450 degrees" is a valid hue, since mathematically that would be equal to 90 degrees.
If I have actually specified an impossible color, I would expect the failure on conversion to come in the form of a recoverable error (such as a Result) rather than a panic. (I do not know whether TryInto provides this with Prisma.)
If panic on converting is intentionally the interface, I would expect a clearer error message.
Running with Rust 1.77.2 on Windows 10, I ran this code :
In other words, I created a color from existing r,g,b values and then attempted to rotate its hue 90 degrees.
On the line
let color = prisma::Rgb::from_color(&color);
I got:However, if I change the rotation line to:
It runs without problems.
Expected behavior