element_51.modelΒΆ

Records for node types and graphs.

Every record is immutable and refuses unknown fields. The JSON these produce is the format the browser layer reads, so field names are a contract with rust/element-51-core/src/model.rs.

Functions

can_link(source, target)

Whether an output of type source may feed an input of type target.

find_input(node_type, name)

Find the input name of a node type, rows that grow included.

value_fits(value, kind)

Whether value is something a port of type kind can carry.

variadic_index(variadic, name)

Read the row number from a port name.

Classes

Graph(*, nodes, links)

The nodes and links the user has built.

Link(*, source, target)

A link from an output port to an input port.

Model()

Base for every record in this project: immutable, no unknown fields.

NodeType(*, name, inputs, outputs[, ...])

The shape of a node: its name and its ports, in drawing order.

PlacedNode(*, id, node_type, x, y[, values, ...])

A node placed in the graph.

Port(*, name, kind)

One input or output of a node type.

PortRef(*, node, port)

One end of a link: a port on a node in the graph.

PortType(*values)

The type of a port.

Variadic(*, prefix, kind)

A node type whose inputs grow as they are linked.