Skip to main content

GraphProfile

Trait GraphProfile 

Source
pub trait GraphProfile {
    // Required methods
    fn type_of_port(&mut self, graph: &Graph, port: PortId) -> Option<TypeDesc>;
    fn validate_graph(&mut self, graph: &Graph) -> Vec<Diagnostic>;

    // Provided methods
    fn plan_connect(
        &mut self,
        graph: &Graph,
        a: PortId,
        b: PortId,
        mode: NodeGraphConnectionMode,
    ) -> ConnectPlan { ... }
    fn allow_cycles(&self, _edge_kind: EdgeKind) -> bool { ... }
    fn concretize_bound(&self) -> usize { ... }
    fn concretize(&mut self, _graph: &Graph) -> Vec<GraphOp> { ... }
}
Expand description

Profile hooks for typed graphs and domain specialization.

Required Methods§

Source

fn type_of_port(&mut self, graph: &Graph, port: PortId) -> Option<TypeDesc>

Returns the current type of a port.

Default implementations may read Port::ty and/or derive from node payloads.

Source

fn validate_graph(&mut self, graph: &Graph) -> Vec<Diagnostic>

Validates a graph and returns diagnostics.

Provided Methods§

Source

fn plan_connect( &mut self, graph: &Graph, a: PortId, b: PortId, mode: NodeGraphConnectionMode, ) -> ConnectPlan

Plans connecting two ports under this profile.

Implementations should call into crate::rules and then enforce extra constraints (type compatibility, cycle policy, exec/data policy, etc.).

Source

fn allow_cycles(&self, _edge_kind: EdgeKind) -> bool

Whether the profile allows cycles for the given edge kind.

Source

fn concretize_bound(&self) -> usize

Maximum number of concretization iterations per edit.

This bounds fixed-point scheduling to prevent oscillation.

Source

fn concretize(&mut self, _graph: &Graph) -> Vec<GraphOp>

Runs concretization for dynamic ports and returns additional ops to apply.

The returned ops must be deterministic and undoable.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§