Struct QWERTY_US

Source
pub struct QWERTY_US { /* private fields */ }

Methods from Deref<Target = Keyboard>§

Source

pub fn capacity(&self) -> (usize, usize)

Return the current node and edge capacity of the graph.

Source

pub fn is_directed(&self) -> bool

Whether the graph has directed edges.

Source

pub fn node_count(&self) -> usize

Return the number of nodes in the graph.

Source

pub fn edge_count(&self) -> usize

Return the number of edges in the graph.

Source

pub fn contains_node(&self, n: N) -> bool

Return true if the node is contained in the graph.

Source

pub fn contains_edge(&self, a: N, b: N) -> bool

Return true if the edge connecting a with b is contained in the graph.

Source

pub fn nodes(&self) -> Nodes<'_, N>

Return an iterator over the nodes of the graph.

Iterator element type is N.

Source

pub fn neighbors(&self, a: N) -> Neighbors<'_, N, Ty>

Return an iterator of all nodes with an edge starting from a.

  • Directed: Outgoing edges from a.
  • Undirected: All edges from or to a.

Produces an empty iterator if the node doesn’t exist.
Iterator element type is N.

Examples found in repository?
examples/simple.rs (line 18)
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}
Source

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 from a.
  • Directed, Incoming: All edges to a.
  • Undirected: All edges from or to a.

Produces an empty iterator if the node doesn’t exist.
Iterator element type is N.

Source

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 from a.
  • Undirected: All edges from or to a.

Produces an empty iterator if the node doesn’t exist.
Iterator element type is (N, &E).

Source

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.

Source

pub fn all_edges(&self) -> AllEdges<'_, N, E, Ty>

Return an iterator over all edges of the graph with their weight in arbitrary order.

Iterator element type is (N, N, &E)

Trait Implementations§

Source§

impl Deref for QWERTY_US

Source§

type Target = GraphMap<Key, Edge, Directed>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Keyboard

Dereferences the value.
Source§

impl LazyStatic for QWERTY_US

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.