nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
259 stars 68 forks source link

Fail to build bindings: trait `From<f32>` is not implemented for `u16` #137

Closed Des-Nerger closed 2 months ago

Des-Nerger commented 2 months ago
   Compiling magick_rust v1.0.0 (https://github.com/nlfiedler/magick-rust#f796041b)
error[E0277]: the trait bound `u16: From<f32>` is not satisfied
   --> /home/ixuta/.cargo/git/checkouts/magick-rust-325de4594d577be6/f796041/src/wand/macros.rs:144:58
    |
137 | / macro_rules! set_get_unchecked {
138 | |     ($($get:ident, $set:ident, $c_get:ident, $c_set:ident, $typ:ty )*) => {
139 | |         $(
140 | |             pub fn $get(&self) -> $typ {
...   |
144 | |                 unsafe { ::bindings::$c_set(self.wand, v.into()) }
    | |                                                          ^^^^ the trait `From<f32>` is not implemented for `u16`, which is required by `f32: Into<_>`
...   |
151 | |     }
152 | | }
    | |_- in this expansion of `set_get_unchecked!`
    |
   ::: /home/ixuta/.cargo/git/checkouts/magick-rust-325de4594d577be6/f796041/src/wand/pixel.rs:94:5
    |
94  | /     set_get_unchecked!(
95  | |         get_color_count, set_color_count, PixelGetColorCount, PixelSetColorCount,   usize
96  | |         get_index,       set_index,       PixelGetIndex,      PixelSetIndex,        f32
97  | |         get_fuzz,        set_fuzz,        PixelGetFuzz,       PixelSetFuzz,         f64
98  | |     );
    | |_____- in this macro invocation
    |
    = help: the following other types implement trait `From<T>`:
              `u16` implements `From<Char>`
              `u16` implements `From<bool>`
              `u16` implements `From<u8>`
    = note: required for `f32` to implement `Into<u16>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `magick_rust` (lib) due to 1 previous error