pub struct NodeParams {
pub sample_rate: f32,
pub parameters: HashMap<String, ParamValue>,
}Expand description
A flexible set of parameters passed to a node constructor.
Uses HashMap<String, ParamValue> so any node type can extract
whatever named parameters it supports. This is intentionally
open-ended — no fixed schema, no required fields.
See [NodeConstructor] (in rill-graph) for how builder uses this.
Fields§
§sample_rate: f32Sample rate the node will be initialized with.
parameters: HashMap<String, ParamValue>Arbitrary named parameters.
Implementations§
Source§impl NodeParams
impl NodeParams
Sourcepub fn new(sample_rate: f32) -> NodeParams
pub fn new(sample_rate: f32) -> NodeParams
Create params with a given sample rate.
Sourcepub fn with(self, key: impl Into<String>, value: ParamValue) -> NodeParams
pub fn with(self, key: impl Into<String>, value: ParamValue) -> NodeParams
Builder-style: insert a parameter and return self.
Sourcepub fn get(&self, key: &str) -> Option<&ParamValue>
pub fn get(&self, key: &str) -> Option<&ParamValue>
Get a parameter by name.
Sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: ParamValue,
) -> Option<ParamValue>
pub fn insert( &mut self, key: impl Into<String>, value: ParamValue, ) -> Option<ParamValue>
Insert or overwrite a parameter.
Sourcepub fn remove(&mut self, key: &str) -> Option<ParamValue>
pub fn remove(&mut self, key: &str) -> Option<ParamValue>
Remove a parameter, returning its value if present.
Trait Implementations§
Source§impl Clone for NodeParams
impl Clone for NodeParams
Source§fn clone(&self) -> NodeParams
fn clone(&self) -> NodeParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NodeParams
impl Debug for NodeParams
Source§impl Default for NodeParams
impl Default for NodeParams
Source§fn default() -> NodeParams
fn default() -> NodeParams
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NodeParams
impl RefUnwindSafe for NodeParams
impl Send for NodeParams
impl Sync for NodeParams
impl Unpin for NodeParams
impl UnsafeUnpin for NodeParams
impl UnwindSafe for NodeParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more