Skip to main content

GraphModel

Trait GraphModel 

Source
pub trait GraphModel {
    // Required methods
    fn nodes(&self) -> Vec<Node>;
    fn edges(&self) -> Vec<Edge>;

    // Provided methods
    fn groups(&self) -> Vec<Group> { ... }
    fn params(&self, _node: &str) -> Vec<Param> { ... }
    fn kinds(&self) -> Vec<Kind> { ... }
    fn can_connect(
        &self,
        from: (&Node, &Port),
        to: (&Node, &Port),
    ) -> Result<(), Refusal> { ... }
}
Expand description

The graph, as the application keeps it. The editor reads it each frame and never changes it: what the user does comes back as Edits for the application to apply.

Required Methods§

Source

fn nodes(&self) -> Vec<Node>

Every node, in drawing order (the last on top).

Source

fn edges(&self) -> Vec<Edge>

Every wire.

Provided Methods§

Source

fn groups(&self) -> Vec<Group>

The groups nodes name.

Source

fn params(&self, _node: &str) -> Vec<Param>

A node’s parameters, shown in the detail view.

Source

fn kinds(&self) -> Vec<Kind>

The kinds of node the canvas’s menu offers to add.

Source

fn can_connect( &self, from: (&Node, &Port), to: (&Node, &Port), ) -> Result<(), Refusal>

Whether an output may feed an input; by default check (same type, another node).

Implementors§