pub struct FlowGraph<N>{
pub graph: SimpleDirectedGraph<N>,
pub start_node: N,
}Expand description
A FlowGraph is a directed graph with a designated start node.
Any node in the graph can be the start node. There are no reachability requirements whatsoever: some nodes may be unreachable from the start node, the start node could have incoming edges, the graph could be disconnected, etc.
Fields§
§graph: SimpleDirectedGraph<N>The graph.
start_node: NThe start node.
Implementations§
Source§impl<N> FlowGraph<N>
impl<N> FlowGraph<N>
Sourcepub fn new(graph: SimpleDirectedGraph<N>, start_node: N) -> Self
pub fn new(graph: SimpleDirectedGraph<N>, start_node: N) -> Self
Constructs a new FlowGraph.
Sourcepub fn create_value_flow_graph<'a, V>(
&self,
node_values: &'a HashMap<N, V>,
) -> FlowGraph<&'a V>
pub fn create_value_flow_graph<'a, V>( &self, node_values: &'a HashMap<N, V>, ) -> FlowGraph<&'a V>
Creates a flow graph of values from a flow graph of nodes.
More precisely, let G be a FlowGraph of nodes with start node S. The value flow graph G’ is a FlowGraph derived from G. Let v(g) be the result of applying value_fn to g. The nodes of G’ are the set of values v(g), for all g in G. For each edge g1->g2 in G, there is a corresponding edge v(g1)->v(g2) in G’. The start node in G’ is v(S).
Returns an error if any value_fn invocation fails.
Sourcepub async fn find_dominator_value<V, VF, E>(
&self,
final_nodes: &[N],
value_fn: VF,
) -> Result<V, FindDominatorValueError<E>>
pub async fn find_dominator_value<V, VF, E>( &self, final_nodes: &[N], value_fn: VF, ) -> Result<V, FindDominatorValueError<E>>
Constructs a value flow graph from the given flow graph and value
function, and finds the closest common dominator value for the
values of the final nodes. Returns an error if value_fn returns an
error for any node in the flow graph. final_nodes must not be empty.
Trait Implementations§
impl<N> Eq for FlowGraph<N>
Source§impl<N> PartialEq for FlowGraph<N>
impl<N> PartialEq for FlowGraph<N>
impl<N> StructuralPartialEq for FlowGraph<N>
Auto Trait Implementations§
impl<N> Freeze for FlowGraph<N>where
N: Freeze,
impl<N> RefUnwindSafe for FlowGraph<N>where
N: RefUnwindSafe,
impl<N> Send for FlowGraph<N>where
N: Send,
impl<N> Sync for FlowGraph<N>where
N: Sync,
impl<N> Unpin for FlowGraph<N>where
N: Unpin,
impl<N> UnsafeUnpin for FlowGraph<N>where
N: UnsafeUnpin,
impl<N> UnwindSafe for FlowGraph<N>where
N: UnwindSafe,
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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