about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDevon Sawatsky <novedevo@gmail.com>2021-09-27 21:10:43 -0700
committergennyble <gen@nyble.dev>2021-09-28 23:05:18 +0000
commita198a047c6ac7985b838b98bb5f0fdf32a328cd5 (patch)
tree1ac4e926a105c923cecf41b5e958cb13bfff7fc5
parent1b948cafcc32d48413a46540caa51b9e9084c7d1 (diff)
downloadcolorsquash-a198a047c6ac7985b838b98bb5f0fdf32a328cd5.tar.gz
colorsquash-a198a047c6ac7985b838b98bb5f0fdf32a328cd5.zip
genericize quantizer
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index f1b23fa..cbd9c43 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -49,7 +49,10 @@ fn main() {
     image.save(outname).expect("Failed to write out");
 }
 
-fn quantize(pixels: Pixels<Rgb<u8>>) -> Vec<Rgb<u8>> {
+fn quantize<'a, T>(pixels: T) -> Vec<Rgb<u8>>
+where
+    T: Iterator<Item = &'a Rgb<u8>>,
+{
     let mut colors: HashMap<Rgb<u8>, usize> = HashMap::new();
 
     //count pixels