-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add combinators for blocks #69
Comments
We already have functional-style blocks ( |
to give a concrete example, you can compose types implementing a trait (for async you have the Stream trait as example): let block = FileSource::<Complex<f32>>::new("my_filename.cf32", false)
.map(|sample| sample * 0.5)
.filter(|sample| sample.abs() < 0.5)
.join(second_file);
let source = fg.add_block(block); |
At the moment, this would be something like: let block = FileSource::<Complex32>::new("my_filename.cf32", false);
let map = Apply::new(|s: &Complex32| s * 0.5);
let filter = Filter::new(|s: &Complex32| if s.abs() < 0.5 { Some(*s) } else { None });
connect!(fg, block > map > filter > second_file); I think this is fine, since the whole point is really to have multiple blocks. At least, this is what has to happen under the hood. Not sure, if it is desired to fake this abstraction. If you want to chain iterators within one block, this could be done with the Iterator block. Then you have file source -> chained iterators in one iterator block -> file sink |
It would be great to have combinators (similar to Iterator's
map
,filter
,join
,reduce
etc.) available for all blocks doing sample or message processing. Normally they are implemented using a trait similar to https://doc.rust-lang.org/std/iter/trait.Iterator.htmlThe text was updated successfully, but these errors were encountered: