zero cost abstraction

This commit is contained in:
2026-06-12 15:15:11 +02:00
parent d3375c0e22
commit b4b2845321
4 changed files with 75 additions and 23 deletions

15
src/pipeline.rs Normal file
View File

@ -0,0 +1,15 @@
use crate::agc::Agc;
use crate::fir::Fir;
use crate::iq_reader::IqChunk;
pub trait DspPipelineExt<E>: Iterator<Item = Result<IqChunk, E>> + Sized {
fn agc(self, sample_rate: f32, target_power: f32, min_gain: f32, max_gain: f32) -> Agc<Self> {
Agc::new(self, sample_rate, target_power, min_gain, max_gain)
}
fn fir<const N: usize>(self, taps: [f32; N], decimation_factor: usize) -> Fir<Self, N> {
Fir::new(self, taps, decimation_factor)
}
}
impl<I, E> DspPipelineExt<E> for I where I: Iterator<Item = Result<IqChunk, E>> {}