pub trait GraphExt: DspNode + Sized {
// Provided methods
fn serial<B: DspNode>(self, other: B) -> Serial<Self, B> { ... }
fn parallel<B: DspNode>(self, other: B) -> Parallel<Self, B> { ... }
fn stack<B: DspNode>(self, other: B) -> Stack<Self, B> { ... }
}Expand description
Extension trait that adds graph-composition methods to every DspNode.
Prefer these methods over the operator impls when chaining more than two nodes, since they avoid having to spell out type parameters:
use resonant_stream::{Chunk, DspNode, StreamError};
use resonant_stream::graph::GraphExt;
struct Noop;
impl DspNode for Noop {
fn process(&mut self, input: Chunk) -> Result<Chunk, StreamError> { Ok(input) }
fn reset(&mut self) {}
}
let _ = Noop.serial(Noop).serial(Noop); // (Noop >> Noop) >> NoopProvided Methods§
Sourcefn serial<B: DspNode>(self, other: B) -> Serial<Self, B>
fn serial<B: DspNode>(self, other: B) -> Serial<Self, B>
Chain self into other serially: self’s output → other’s input.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.