From 2941890adf294964a6f4fc13d39ed490f45ce043 Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Tue, 17 Mar 2020 22:41:00 +0100 Subject: [PATCH] Copy works better than Clone --- src/resamplers.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/resamplers.rs b/src/resamplers.rs index 0097535..e2ff458 100644 --- a/src/resamplers.rs +++ b/src/resamplers.rs @@ -3,7 +3,7 @@ use std::iter::FromIterator; pub struct Upsampler<'a, NumType> where - NumType: Num + Clone, + NumType: Num + Copy, { factor: u16, state: u16, @@ -13,7 +13,7 @@ where impl<'a, NumType> Upsampler<'a, NumType> where - NumType: Num + Clone, + NumType: Num + Copy, { pub fn from(iterator: I, factor: u16) -> Upsampler<'a, NumType> where @@ -30,7 +30,7 @@ where impl<'a, NumType> Iterator for Upsampler<'a, NumType> where - NumType: Num + Clone, + NumType: Num + Copy, { type Item = NumType; @@ -40,13 +40,13 @@ where } self.state = (self.state + 1) % self.factor; - return self.sample.clone(); + return self.sample; } } pub struct Downsampler<'a, NumType> where - NumType: Num + Clone + NumCast, + NumType: Num + Copy + NumCast, { factor: u16, iterator: Box + 'a>, @@ -54,7 +54,7 @@ where impl<'a, NumType> Downsampler<'a, NumType> where - NumType: Num + Clone + NumCast, + NumType: Num + Copy + NumCast, { pub fn from(iterator: I, factor: u16) -> Downsampler<'a, NumType> where @@ -69,7 +69,7 @@ where impl<'a, NumType> Iterator for Downsampler<'a, NumType> where - NumType: Num + Clone + NumCast, + NumType: Num + Copy + NumCast, { type Item = NumType;