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§
Sourcefn type_of_port(&mut self, graph: &Graph, port: PortId) -> Option<TypeDesc>
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.
Sourcefn validate_graph(&mut self, graph: &Graph) -> Vec<Diagnostic>
fn validate_graph(&mut self, graph: &Graph) -> Vec<Diagnostic>
Validates a graph and returns diagnostics.
Provided Methods§
Sourcefn plan_connect(
&mut self,
graph: &Graph,
a: PortId,
b: PortId,
mode: NodeGraphConnectionMode,
) -> ConnectPlan
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.).
Sourcefn allow_cycles(&self, _edge_kind: EdgeKind) -> bool
fn allow_cycles(&self, _edge_kind: EdgeKind) -> bool
Whether the profile allows cycles for the given edge kind.
Sourcefn concretize_bound(&self) -> usize
fn concretize_bound(&self) -> usize
Maximum number of concretization iterations per edit.
This bounds fixed-point scheduling to prevent oscillation.
Sourcefn concretize(&mut self, _graph: &Graph) -> Vec<GraphOp>
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".