Trait WdfLeaf
pub trait WdfLeaf {
// Required methods
fn port_resistance(&self) -> f64;
fn reflected(&self) -> f64;
fn set_incident(&mut self, a: f64);
// Provided methods
fn set_sample_rate(&mut self, _sample_rate: f64) { ... }
fn reset(&mut self) { ... }
}Expand description
One-port WDF leaf element (resistor, capacitor, inductor, voltage source).
Leaf elements sit at the ends of the WDF binary tree and interact with
the wave domain through incident (a) and reflected (b) waves.
Required Methods§
fn port_resistance(&self) -> f64
fn port_resistance(&self) -> f64
Port resistance seen looking into this element (Ω).
fn reflected(&self) -> f64
fn reflected(&self) -> f64
Produce the reflected wave given the current state.
For resistors: b = 0 (matched termination)
For capacitors: b = z⁻¹ a (previous incident)
For inductors: b = -z⁻¹ a
For voltage sources: b = 2*Vs - a
fn set_incident(&mut self, a: f64)
fn set_incident(&mut self, a: f64)
Accept the incident wave after scatter_down phase.
Reactive elements (C, L) latch this value as state for next sample.
Provided Methods§
fn set_sample_rate(&mut self, _sample_rate: f64)
fn set_sample_rate(&mut self, _sample_rate: f64)
Update sample rate (for reactive elements C, L).
fn reset(&mut self)
fn reset(&mut self)
Reset internal state to zero.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".