pub struct QWERTY_UK { /* private fields */ }Methods from Deref<Target = Keyboard>§
Sourcepub fn capacity(&self) -> (usize, usize)
pub fn capacity(&self) -> (usize, usize)
Return the current node and edge capacity of the graph.
Sourcepub fn is_directed(&self) -> bool
pub fn is_directed(&self) -> bool
Whether the graph has directed edges.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes in the graph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Return the number of edges in the graph.
Sourcepub fn contains_node(&self, n: N) -> bool
pub fn contains_node(&self, n: N) -> bool
Return true if the node is contained in the graph.
Sourcepub fn contains_edge(&self, a: N, b: N) -> bool
pub fn contains_edge(&self, a: N, b: N) -> bool
Return true if the edge connecting a with b is contained in the graph.
Sourcepub fn nodes(&self) -> Nodes<'_, N>
pub fn nodes(&self) -> Nodes<'_, N>
Return an iterator over the nodes of the graph.
Iterator element type is N.
Sourcepub fn neighbors(&self, a: N) -> Neighbors<'_, N, Ty>
pub fn neighbors(&self, a: N) -> Neighbors<'_, N, Ty>
Return an iterator of all nodes with an edge starting from a.
Directed: Outgoing edges froma.Undirected: All edges from or toa.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is N.
Examples found in repository?
8fn simple() {
9
10 let ampersand = QWERTY_US.find_key('h');
11
12 match ampersand {
13 Some(_) => println!("Key exists"),
14 None => println!("Key doesn't exist in layout"),
15 }
16
17 if let Some(key) = ampersand {
18 for n in QWERTY_US.neighbors(key) {
19 println!("{:?}", n);
20 }
21 }
22 println!("{:?}", Dot::with_config(&*QWERTY_US, &[Config::EdgeNoLabel]));
23}Sourcepub fn neighbors_directed(
&self,
a: N,
dir: Direction,
) -> NeighborsDirected<'_, N, Ty>
pub fn neighbors_directed( &self, a: N, dir: Direction, ) -> NeighborsDirected<'_, N, Ty>
Return an iterator of all neighbors that have an edge between them and
a, in the specified direction.
If the graph’s edges are undirected, this is equivalent to .neighbors(a).
Directed,Outgoing: All edges froma.Directed,Incoming: All edges toa.Undirected: All edges from or toa.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is N.
Sourcepub fn edges(&self, from: N) -> Edges<'_, N, E, Ty>
pub fn edges(&self, from: N) -> Edges<'_, N, E, Ty>
Return an iterator of target nodes with an edge starting from a,
paired with their respective edge weights.
Directed: Outgoing edges froma.Undirected: All edges from or toa.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is (N, &E).
Sourcepub fn edge_weight(&self, a: N, b: N) -> Option<&E>
pub fn edge_weight(&self, a: N, b: N) -> Option<&E>
Return a reference to the edge weight connecting a with b, or
None if the edge does not exist in the graph.