dasp_window/
rectangle.rs

1use crate::Window;
2
3use dasp_sample::Sample;
4
5/// The simplest window type, equivalent to replacing all but *N* values of data sequence by
6/// zeroes, making it appear as though the waveform suddenly turns on and off.
7///
8/// ### Required Features
9///
10/// - When using `dasp_window`, this item requires the **rectangle** feature to be enabled.
11/// - When using `dasp`, this item requires the **window-rectangle** feature to be enabled.
12#[derive(Clone, Copy, Debug, PartialEq, Eq)]
13pub struct Rectangle;
14
15impl<S> Window<S> for Rectangle
16where
17    S: Sample,
18{
19    type Output = S;
20    fn window(_phase: S) -> Self::Output {
21        S::IDENTITY.to_sample::<S>()
22    }
23}