pub struct InReader<'a, 'c> { /* private fields */ }Expand description
Field reader used by node factories: classifies each field as
literal / $param / @node and accumulates the node’s scalar
port plumbing. See the module docs for the usage pattern.
Implementations§
Source§impl<'a, 'c> InReader<'a, 'c>
impl<'a, 'c> InReader<'a, 'c>
Sourcepub fn new(
fields: &'a Map<String, Value>,
ctx: &'a FactoryCtx<'c>,
fixed_ports: usize,
) -> Self
pub fn new( fields: &'a Map<String, Value>, ctx: &'a FactoryCtx<'c>, fixed_ports: usize, ) -> Self
fixed_ports is the number of input ports the node declares
before any scalar ports (e.g. 1 for blur’s input). Scalar
port indices start there.
Sourcepub fn number(&mut self, name: &'static str) -> Result<In<f64>, FactoryError>
pub fn number(&mut self, name: &'static str) -> Result<In<f64>, FactoryError>
Required number field.
Sourcepub fn number_or(
&mut self,
name: &'static str,
default: f64,
) -> Result<In<f64>, FactoryError>
pub fn number_or( &mut self, name: &'static str, default: f64, ) -> Result<In<f64>, FactoryError>
Optional number field with a default.
Sourcepub fn color(
&mut self,
name: &'static str,
) -> Result<In<[f32; 4]>, FactoryError>
pub fn color( &mut self, name: &'static str, ) -> Result<In<[f32; 4]>, FactoryError>
Required color field (#rrggbb[aa], $param, or @node).
Sourcepub fn color_or(
&mut self,
name: &'static str,
default: [f32; 4],
) -> Result<In<[f32; 4]>, FactoryError>
pub fn color_or( &mut self, name: &'static str, default: [f32; 4], ) -> Result<In<[f32; 4]>, FactoryError>
Optional color field with a default.
Sourcepub fn color_opt(
&mut self,
name: &'static str,
) -> Result<Option<In<[f32; 4]>>, FactoryError>
pub fn color_opt( &mut self, name: &'static str, ) -> Result<Option<In<[f32; 4]>>, FactoryError>
Optional color field; None when absent.
Sourcepub fn bool_or(
&mut self,
name: &'static str,
default: bool,
) -> Result<In<bool>, FactoryError>
pub fn bool_or( &mut self, name: &'static str, default: bool, ) -> Result<In<bool>, FactoryError>
Optional bool field with a default.
Sourcepub fn nested<T: ScalarType>(
&mut self,
label: &str,
v: &Value,
) -> Result<In<T>, FactoryError>
pub fn nested<T: ScalarType>( &mut self, label: &str, v: &Value, ) -> Result<In<T>, FactoryError>
Read a scalar that lives inside a composite field — one stop of
a colour ramp, one entry of a palette, one number of a dash
pattern. label names the position for error messages
("stops[2].color").
Accepts a literal or a $param, but not a @node: a port needs
a &'static str name and its own slot in Node::inputs(), and a
table of unknown length can offer neither. Resolve the whole
table once per eval, never per pixel.