rustradio/xor.rs
1//! Xor two streams.
2use crate::stream::{ReadStream, WriteStream};
3
4/// Xors a constant value to every sample.
5#[derive(rustradio_macros::Block)]
6#[rustradio(crate, new, sync)]
7pub struct Xor<T>
8where
9 T: Copy + std::ops::BitXor<Output = T>,
10{
11 #[rustradio(in)]
12 a: ReadStream<T>,
13 #[rustradio(in)]
14 b: ReadStream<T>,
15 #[rustradio(out)]
16 dst: WriteStream<T>,
17}
18
19impl<T> Xor<T>
20where
21 T: Copy + std::ops::BitXor<Output = T>,
22{
23 fn process_sync(&self, a: T, b: T) -> T {
24 a ^ b
25 }
26}