Switching things to tagged type

This commit is contained in:
2026-03-20 20:22:36 +01:00
parent 822cdc1587
commit ac5c9eeaa0
6 changed files with 254 additions and 154 deletions

View File

@ -28,10 +28,8 @@ use oxydsp_flowgraph::io::Out;
use oxydsp_flowgraph::io::PopIterable;
use oxydsp_flowgraph::sync_block;
use crate::printer_synchronous_block::PrinterView;
#[derive(BlockIO)]
#[sync_block]
#[sync_block(tagged)]
pub struct Printer<T: 'static + Display>
{
#[input]
@ -40,6 +38,25 @@ pub struct Printer<T: 'static + Display>
n: usize,
}
// impl<T: 'static + Display> Block for Printer<T>
// where
// T: Display,
// {
// fn work(&mut self) -> oxydsp_flowgraph::block::BlockResult
// {
// for x in self.input.pop_iter()
// {
// if self.n.is_multiple_of(2usize.pow(20))
// {
// println!("{}", x.0);
// self.n = 0;
// }
// self.n += 1;
// }
// BlockResult::Ok
// }
// }
impl<'view, T: 'static + Display> SyncBlock<'view> for Printer<T>
{
fn sync_work(state: Self::StateView, input: Self::Input) -> Option<Self::Output>