Skip to main content

NodeTemplate

Trait NodeTemplate 

Source
pub trait NodeTemplate<N, P> {
    // Required methods
    fn node_data(&self) -> N;
    fn port_data(&self) -> Vec<P>;
}
Expand description

A reusable component definition: node data plus an ordered pinout.

Object-safe by design (Vec<P>, not impl Iterator), so libraries can be Vec<Box<dyn NodeTemplate<N, P>>>.

Required Methods§

Source

fn node_data(&self) -> N

Fresh node data for one instance of this component.

Source

fn port_data(&self) -> Vec<P>

Fresh port data for one instance, in pinout order. The PortIds returned by Graph::instantiate correspond to this order, index for index.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<N: Clone, P: Clone> NodeTemplate<N, P> for NodeProto<N, P>