Node

Struct Node 

Source
pub struct Node<S: Stage> {
    pub stage: S,
    pub state: S::State,
    pub inputs: S::Input,
    pub outputs: S::Output,
    pub cache: HashMap<u64, Vec<Cached<S>>>,
    pub input_changed: bool,
}
Expand description

Every node wraps a Stage, which is a decorated function that has some number of inputs and some number of outputs.

TODO: Explain the caching functionality in detail

Fields§

§stage: S§state: S::State§inputs: S::Input§outputs: S::Output§cache: HashMap<u64, Vec<Cached<S>>>§input_changed: bool

Implementations§

Source§

impl<S: Stage> Node<S>

Source

pub fn new(stage: S, initial_state: S::State) -> Self

Trait Implementations§

Source§

impl<S: Stage + Send + Sync + 'static> AnyNode for Node<S>

Source§

fn stage_shape(&self) -> &'static StageShape

Gets the shape of the stage
Source§

fn into_any(self: Box<Self>) -> Box<dyn Any>

Upcast to dyn Any to get its more-specific downcast capabilities
Source§

fn as_any(&self) -> &dyn Any

Primarily used for internal checks
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

USed to get mutable access to state
Source§

fn reeval_rule(&self) -> ReevaluationRule

Source§

fn eval(&mut self) -> Result<Box<dyn DynFields>, InjectionError>

Evaluates the node. Returns a map of prior outputs
Source§

fn flow_data( &mut self, child: &mut Box<dyn AnyNode>, output: Option<&'static str>, input: Option<&'static str>, ) -> Result<(), InjectionError>

This a a core part of the plumbing of this crate - take the outputs of a parent node and use them to set the inputs of a child node.
Source§

fn inputs_mut(&mut self) -> &mut dyn DynFields

Used to support [Self::flow_data]
Source§

fn outputs_mut(&mut self) -> &mut dyn DynFields

Used to support [Self::flow_data]
Source§

fn set_input_changed(&mut self, val: bool)

Used to indicate that an input has been modified from a previous run.
Source§

fn input_changed(&self) -> bool

See [Self::set_input_changed]
Source§

fn cache_mut(&mut self) -> &mut dyn Any

Source§

fn clear_state(&mut self)

Source§

impl<S: Debug + Stage> Debug for Node<S>
where S::State: Debug, S::Input: Debug, S::Output: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Node<S>
where S: Freeze, <S as Stage>::State: Freeze, <S as Stage>::Input: Freeze, <S as Stage>::Output: Freeze,

§

impl<S> RefUnwindSafe for Node<S>

§

impl<S> Send for Node<S>
where S: Send,

§

impl<S> Sync for Node<S>
where S: Sync,

§

impl<S> Unpin for Node<S>
where S: Unpin, <S as Stage>::State: Unpin, <S as Stage>::Input: Unpin, <S as Stage>::Output: Unpin,

§

impl<S> UnwindSafe for Node<S>
where S: UnwindSafe, <S as Stage>::State: UnwindSafe, <S as Stage>::Input: UnwindSafe, <S as Stage>::Output: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.