From 4e58aeb5c78f6387a1248c86855d8fe05035fd0c Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 1 May 2017 13:16:06 +0200 Subject: [PATCH] Implement Source on Box --- src/source/mod.rs | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/source/mod.rs b/src/source/mod.rs index 71116af..9d6dc31 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -227,3 +227,69 @@ pub trait Source: Iterator SamplesConverter::new(self) } } + +impl Source for Box> where S: Sample { + #[inline] + fn current_frame_len(&self) -> Option { + (**self).current_frame_len() + } + + #[inline] + fn channels(&self) -> u16 { + (**self).channels() + } + + #[inline] + fn samples_rate(&self) -> u32 { + (**self).samples_rate() + } + + #[inline] + fn total_duration(&self) -> Option { + (**self).total_duration() + } +} + +impl Source for Box + Send> where S: Sample { + #[inline] + fn current_frame_len(&self) -> Option { + (**self).current_frame_len() + } + + #[inline] + fn channels(&self) -> u16 { + (**self).channels() + } + + #[inline] + fn samples_rate(&self) -> u32 { + (**self).samples_rate() + } + + #[inline] + fn total_duration(&self) -> Option { + (**self).total_duration() + } +} + +impl Source for Box + Send + Sync> where S: Sample { + #[inline] + fn current_frame_len(&self) -> Option { + (**self).current_frame_len() + } + + #[inline] + fn channels(&self) -> u16 { + (**self).channels() + } + + #[inline] + fn samples_rate(&self) -> u32 { + (**self).samples_rate() + } + + #[inline] + fn total_duration(&self) -> Option { + (**self).total_duration() + } +}