Made AM demodulator more generic
This commit is contained in:
parent
da69d0c76e
commit
9319203a22
|
@ -1,13 +1,20 @@
|
|||
use num::traits::Float;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
pub struct SquaringAMDemodulator<'a> {
|
||||
iterator: Box<dyn Iterator<Item = f32> + 'a>,
|
||||
pub struct SquaringAMDemodulator<'a, NumType>
|
||||
where
|
||||
NumType: Float,
|
||||
{
|
||||
iterator: Box<dyn Iterator<Item = NumType> + 'a>,
|
||||
}
|
||||
|
||||
impl<'a> SquaringAMDemodulator<'a> {
|
||||
pub fn from<I>(iterator1: I) -> SquaringAMDemodulator<'a>
|
||||
impl<'a, NumType> SquaringAMDemodulator<'a, NumType>
|
||||
where
|
||||
NumType: Float,
|
||||
{
|
||||
pub fn from<I>(iterator1: I) -> SquaringAMDemodulator<'a, NumType>
|
||||
where
|
||||
I: Iterator<Item = f32> + 'a,
|
||||
I: Iterator<Item = NumType> + 'a,
|
||||
{
|
||||
SquaringAMDemodulator {
|
||||
iterator: Box::new(iterator1),
|
||||
|
@ -15,8 +22,11 @@ impl<'a> SquaringAMDemodulator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for SquaringAMDemodulator<'a> {
|
||||
type Item = f32;
|
||||
impl<'a, NumType> Iterator for SquaringAMDemodulator<'a, NumType>
|
||||
where
|
||||
NumType: Float,
|
||||
{
|
||||
type Item = NumType;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
match self.iterator.next() {
|
||||
|
|
Loading…
Reference in New Issue