From b134a6a352e3198f85b6778a19cc5a924f3b7638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20C=C3=B4rte-Real?= Date: Thu, 21 Feb 2019 23:15:07 +0000 Subject: [PATCH] Replace Clone in CFA with a derive Closes #15 --- src/decoders/cfa.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/decoders/cfa.rs b/src/decoders/cfa.rs index 11de5bc..4ef33c3 100644 --- a/src/decoders/cfa.rs +++ b/src/decoders/cfa.rs @@ -17,6 +17,7 @@ use std::fmt; /// initialized and ready to be used in processing. The color_at() implementation is /// designed to be fast so it can be called inside the inner loop of demosaic or other /// color-aware algorithms that work on pre-demosaic data +#[derive(Clone)] pub struct CFA { /// CFA pattern as a String pub name: String, @@ -183,20 +184,3 @@ impl fmt::Debug for CFA { write!(f, "CFA {{ {} }}", self.name) } } - -impl Clone for CFA { - fn clone(&self) -> CFA { - let mut cpattern: [[usize;48];48] = [[0;48];48]; - for row in 0..48 { - for col in 0..48 { - cpattern[row][col] = self.pattern[row][col]; - } - } - CFA { - name: self.name.clone(), - pattern: cpattern, - width: self.width, - height: self.height, - } - } -}