Struct nannou::ui::graph::Graph
[−]
[src]
pub struct Graph { /* fields omitted */ }
Stores the dynamic state of a UI tree of Widgets.
Methods
impl Graph
[src]
fn new() -> Graph
[src]
A new empty Graph.
fn with_node_capacity(n_nodes: usize) -> Graph
[src]
A new Graph with the given node capacity.
We know that there can be no more than three parents per node as the public API enforces a maximum of one Depth, Position and Graphic parent each. Thus, we can assume an edge capacity of exactly three times the given node capacity.
fn clear(&mut self)
[src]
Removes all Nodes and Edges from the Graph.
fn node_count(&self) -> usize
[src]
The total number of Nodes in the Graph.
fn widget_count(&self) -> usize
[src]
The total number of Node::Widgets in the Graph.
fn edge_count(&self) -> usize
[src]
The total number of Edges in the Graph.
fn node_capacity(&self) -> usize
[src]
The current capacity for the Graph's internal node Vec
.
fn add_placeholder(&mut self) -> NodeIndex<u32>
[src]
Add a new placeholder node and return it's widget::Id
into the Graph
.
This method is used by the widget::set_widget
function when some internal widget does not
yet have it's own widget::Id
.
fn node(&self, idx: NodeIndex<u32>) -> Option<&Node>
[src]
Borrow the node at the given widget::Id if there is one.
fn node_mut(&mut self, idx: NodeIndex<u32>) -> Option<&mut Node>
[src]
Mutably borrow the node at the given widget::Id if there is one.
fn edge(&self, idx: EdgeIndex<u32>) -> Option<&Edge>
[src]
Borrow the edge at the given EdgeIndex if there is one.
fn edge_mut(&mut self, idx: EdgeIndex<u32>) -> Option<&mut Edge>
[src]
Mutably borrow the edge at the given EdgeIndex if there is one.
fn edge_endpoints(
&self,
idx: EdgeIndex<u32>
) -> Option<(NodeIndex<u32>, NodeIndex<u32>)>
[src]
&self,
idx: EdgeIndex<u32>
) -> Option<(NodeIndex<u32>, NodeIndex<u32>)>
Return the parent and child nodes on either end of the Edge at the given index.
fn widget(&self, idx: NodeIndex<u32>) -> Option<&Container>
[src]
If there is a Widget for the given index, return a reference to it.
fn widget_mut(&mut self, idx: NodeIndex<u32>) -> Option<&mut Container>
[src]
If there is a Widget for the given Id, return a mutable reference to it.
fn parents(&self, child: NodeIndex<u32>) -> Parents<Node, Edge, u32>
[src]
A Walker type that may be used to step through the parents of the given child node.
fn recursive_walk<F>(
&self,
start: NodeIndex<u32>,
recursive_fn: F
) -> Recursive<Graph, u32, F> where
F: FnMut(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>,
[src]
&self,
start: NodeIndex<u32>,
recursive_fn: F
) -> Recursive<Graph, u32, F> where
F: FnMut(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>,
A Walker type that recursively walks the Graph using the given recursive_fn
.
Panics If the given start index does not exist within the Graph.
fn edge_parent(&self, idx: NodeIndex<u32>, edge: Edge) -> Option<NodeIndex<u32>>
[src]
If the widget at the given index has some parent along an Edge of the given variant, return an index to it.
fn depth_parent(&self, idx: NodeIndex<u32>) -> Option<NodeIndex<u32>>
[src]
Return the index of the parent along the given widget's Depth Edge.
fn x_position_parent(&self, idx: NodeIndex<u32>) -> Option<NodeIndex<u32>>
[src]
Return the index of the parent along the given widget's Position Edge.
fn y_position_parent(&self, idx: NodeIndex<u32>) -> Option<NodeIndex<u32>>
[src]
Return the index of the parent along the given widget's Position Edge.
fn position_parents(
&self,
idx: NodeIndex<u32>
) -> Chain<IntoIter<NodeIndex<u32>>, IntoIter<NodeIndex<u32>>>
[src]
&self,
idx: NodeIndex<u32>
) -> Chain<IntoIter<NodeIndex<u32>>, IntoIter<NodeIndex<u32>>>
Produces an iterator yielding the parents along both the X and Y Position Edges respectively.
fn graphic_parent(&self, idx: NodeIndex<u32>) -> Option<NodeIndex<u32>>
[src]
Return the index of the parent along the given widget's Graphic Edge.
fn depth_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks Depth parents starting from the given node.
fn x_position_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks X Position parents starting from the given node.
fn y_position_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks Y Position parents starting from the given node.
fn graphic_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks Graphic parents starting from the given node.
fn scrollable_y_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks Depth parents that are scrollable along the y axis for the given node.
fn scrollable_x_parent_recursion(
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
[src]
&self,
idx: NodeIndex<u32>
) -> Recursive<Graph, u32, fn(&Graph, NodeIndex<u32>) -> Option<(EdgeIndex<u32>, NodeIndex<u32>)>>
A Walker type that recursively walks Depth parents that are scrollable along the x axis for the given node.
fn children(&self, parent: NodeIndex<u32>) -> Children<Node, Edge, u32>
[src]
A Walker type that may be used to step through the children of the given parent node.
fn depth_children(
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
[src]
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
For walking the Depth children of the given parent node.
fn x_position_children(
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
[src]
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
For walking the Position(X) children of the given parent node.
fn y_position_children(
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
[src]
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
For walking the Position(Y) children of the given parent node.
fn position_children(
&self,
idx: NodeIndex<u32>
) -> Chain<Graph, u32, Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>, Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>>
[src]
&self,
idx: NodeIndex<u32>
) -> Chain<Graph, u32, Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>, Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>>
For walking the Position children of the given parent node.
This first walks the Axis::X children, before walking the Axis::Y children.
fn graphic_children(
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
[src]
&self,
idx: NodeIndex<u32>
) -> Filter<Children<Node, Edge, u32>, fn(&Graph, EdgeIndex<u32>, NodeIndex<u32>) -> bool>
For walking the Graphic children of the given parent node.
fn does_edge_exist<F>(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>,
is_edge: F
) -> bool where
F: Fn(Edge) -> bool,
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>,
is_edge: F
) -> bool where
F: Fn(Edge) -> bool,
Does the given edge type exist between the nodes parent
-> child
.
Returns false
if either of the given node indices do not exist.
fn does_depth_edge_exist(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
Does a Edge::Depth exist between the nodes parent
-> child
.
Returns false
if either of the given node indices do not exist.
fn does_position_edge_exist(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
Does a Edge::Position exist between the nodes parent
-> child
.
Returns false
if either of the given node indices do not exist.
fn does_graphic_edge_exist(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
Does a Edge::Graphic exist between the nodes parent
-> child
.
Returns false
if either of the given node indices do not exist.
fn does_recursive_edge_exist<F>(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>,
is_edge: F
) -> bool where
F: Fn(Edge) -> bool,
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>,
is_edge: F
) -> bool where
F: Fn(Edge) -> bool,
Are the given parent
and child
nodes connected by a single chain of edges of the given
kind?
i.e. parent
-> x -> y -> child
.
Returns false
if either of the given node indices do not exist.
fn does_recursive_depth_edge_exist(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
Are the given parent
and child
nodes connected by a single chain of Depth edges?
i.e. parent
-> x -> y -> child
.
Returns false
if either of the given node indices do not exist.
fn does_recursive_graphic_edge_exist(
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
[src]
&self,
parent: NodeIndex<u32>,
child: NodeIndex<u32>
) -> bool
Are the given parent
and child
nodes connected by a single chain of Graphic edges?
i.e. parent
-> x -> y -> child
.
Returns false
if either of the given node indices do not exist.
fn pre_update_cache(
&mut self,
root: NodeIndex<u32>,
widget: PreUpdateCache,
instantiation_order_idx: usize
)
[src]
&mut self,
root: NodeIndex<u32>,
widget: PreUpdateCache,
instantiation_order_idx: usize
)
Cache some PreUpdateCache
widget data into the graph.
This is called (via the ui
module) from within the widget::set_widget
function prior to
the Widget::update
method being called.
This is done so that if this Widget were to internally set
some other Widget
s within
its own update
method, this Widget
s positioning and dimension data already exists
within the Graph
for reference.
fn post_update_cache<W>(&mut self, widget: PostUpdateCache<W>) where
W: Widget,
<W as Widget>::State: 'static,
<W as Widget>::Style: 'static,
[src]
W: Widget,
<W as Widget>::State: 'static,
<W as Widget>::Style: 'static,
Cache some PostUpdateCache
widget data into the graph.
This is called (via the ui
module) from within the widget::set_widget
function after
the Widget::update
method is called and some new state is returned.
Trait Implementations
impl Debug for Graph
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl Index<EdgeIndex<u32>> for Graph
[src]
type Output = Edge
The returned type after indexing.
fn index(&'a self, idx: EdgeIndex<u32>) -> &'a Edge
[src]
Performs the indexing (container[index]
) operation.
impl Index<NodeIndex<u32>> for Graph
[src]
type Output = Node
The returned type after indexing.
fn index(&'a self, id: NodeIndex<u32>) -> &'a Node
[src]
Performs the indexing (container[index]
) operation.