kornelski / dssim

Image similarity comparison simulating human perception (multiscale SSIM in Rust)
https://kornel.ski/dssim
GNU Affero General Public License v3.0
1.07k stars 69 forks source link

Missing 'itertools::Itertools' for `zip_eq` in dssim-core when using wasm #115

Closed InfiRandia closed 2 years ago

InfiRandia commented 2 years ago

I'm building and using your lib together with yew, wasm etc when I encountered this.

Error:

   Compiling dssim-core v3.2.0
error[E0599]: no method named `zip_eq` found for struct `Cloned` in the current scope
   --> /home/------/.cargo/registry/src/github.com-1ecc6299db9ec823/dssim-core-3.2.0/src/dssim.rs:400:66
    |
400 |         let mu_iter = original.mu.as_slice().par_iter().cloned().zip_eq(modified.mu.as_slice().par_iter().cloned());
    |                                                                  ^^^^^^ method not found in `Cloned<std::slice::Iter<'_, L>>`
    |
   ::: /home/------/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.10.3/src/lib.rs:549:8
    |
549 |     fn zip_eq<J>(self, other: J) -> ZipEq<Self, J::IntoIter>
    |        ------ the method is available for `Cloned<std::slice::Iter<'_, L>>` here
    |
    = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
22  | use itertools::Itertools;
    |

For more information about this error, try `rustc --explain E0599`.

It seems adding use itertools::Itertools; to dssim.rs under dssim-core solves the problem when running it in wasm32-unknown-unknown with rayon disabled by using:

Cargo.toml:

dssim-core = { version = "3.2", default-features = false }

Maybe I'm missing something, but I thought it would be good to drop this issue here

kornelski commented 2 years ago

Yeah, it needs that use that the compiler suggests :/

kornelski commented 2 years ago

Fixed. Run cargo update.