image-rs / imageproc

Image processing operations
MIT License
723 stars 144 forks source link

Use `Kernel` by `ref` #652

Closed cospectrum closed 1 month ago

cospectrum commented 1 month ago

Maybe filter_clamped and friends should use Kernel via ref instead of move?

cospectrum commented 1 month ago

I think it will work fine. This code compiles, for example

fn main() {
    take_ref(&Kernel::new(&[1, 2, 3, 4], 2, 2));
}

fn take_ref<T>(kernel: &Kernel<T>) {
}
cospectrum commented 1 month ago

Oh, no, I'm wrong. No problems with move, since we derived Copy. Cool