Struct Graph
pub struct Graph {
pub nodes: BTreeMap<String, GraphNode>,
pub edges: BTreeSet<Edge>,
}Fields§
§nodes: BTreeMap<String, GraphNode>§edges: BTreeSet<Edge>Implementations§
§impl Graph
impl Graph
pub fn insert(&mut self, node: GraphNode)
pub fn connect(&mut self, edge: Edge) -> Result<(), ConnectError>
pub fn connect(&mut self, edge: Edge) -> Result<(), ConnectError>
Connect typed ports. Processing graphs are DAGs: rejecting a cycle at the edit boundary means evaluators never need a recursion escape hatch.
§Errors
Returns the precise structural reason when either endpoint/port is unknown, the port types differ, the input is occupied, or the edge would introduce a cycle.
pub fn disconnect_input(&mut self, node: &str, port: &str) -> Option<Edge>
pub fn reconnect_input(
&mut self,
edge: Edge,
) -> Result<Option<Edge>, ConnectError>
pub fn reconnect_input( &mut self, edge: Edge, ) -> Result<Option<Edge>, ConnectError>
Replace one input connection atomically. If the proposed edge is invalid (including a cycle or type mismatch), the previous edge is restored so an imprecise pointer drop can never damage the graph.
§Errors
Returns the same structural error as Self::connect when the new
edge has an invalid endpoint, incompatible type, occupied input, or
would introduce a cycle.
pub fn contributing_nodes(&self, target: &str) -> BTreeSet<String>
pub fn contributing_nodes(&self, target: &str) -> BTreeSet<String>
The target and every node that contributes to it. Editors use this to distinguish intentional side branches from the live production path.
pub fn remove(&mut self, id: &str) -> Option<GraphNode>
pub fn evaluation_order(&self) -> Result<Vec<String>, ConnectError>
pub fn evaluation_order(&self) -> Result<Vec<String>, ConnectError>
Return a stable topological order for evaluation.
§Errors
Returns ConnectError::Cycle if the graph was deserialized from an
invalid source that bypassed Graph::connect.
Trait Implementations§
§impl<'de> Deserialize<'de> for Graph
impl<'de> Deserialize<'de> for Graph
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Graph, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Graph, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Graph
impl Serialize for Graph
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Graph
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more