Skip to main content

InReader

Struct InReader 

Source
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>

Source

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.

Source

pub fn number(&mut self, name: &'static str) -> Result<In<f64>, FactoryError>

Required number field.

Source

pub fn number_or( &mut self, name: &'static str, default: f64, ) -> Result<In<f64>, FactoryError>

Optional number field with a default.

Source

pub fn color( &mut self, name: &'static str, ) -> Result<In<[f32; 4]>, FactoryError>

Required color field (#rrggbb[aa], $param, or @node).

Source

pub fn color_or( &mut self, name: &'static str, default: [f32; 4], ) -> Result<In<[f32; 4]>, FactoryError>

Optional color field with a default.

Source

pub fn color_opt( &mut self, name: &'static str, ) -> Result<Option<In<[f32; 4]>>, FactoryError>

Optional color field; None when absent.

Source

pub fn bool_or( &mut self, name: &'static str, default: bool, ) -> Result<In<bool>, FactoryError>

Optional bool field with a default.

Source

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.

Source

pub fn finish(self) -> InParts

Hand back the accumulated ports / connections / param refs.

Auto Trait Implementations§

§

impl<'a, 'c> Freeze for InReader<'a, 'c>

§

impl<'a, 'c> RefUnwindSafe for InReader<'a, 'c>

§

impl<'a, 'c> Send for InReader<'a, 'c>

§

impl<'a, 'c> Sync for InReader<'a, 'c>

§

impl<'a, 'c> Unpin for InReader<'a, 'c>

§

impl<'a, 'c> UnsafeUnpin for InReader<'a, 'c>

§

impl<'a, 'c> UnwindSafe for InReader<'a, 'c>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more