[−][src]Struct pathfinder::Network
Enables traversing through a network of connected nodes.
Checking if a path is valid and setting new paths.
Fields
hash_map: [Option<T>; 666]
Methods
impl<T: Draw + Hash + Copy> Network<T>
[src]
impl Network<Node>
[src]
pub fn path<'a>(&'a self, a: &str, b: &str) -> Result<Vec<Node>>
[src]
Calculates the path from node A to node B.
Examples
let nodes = Node::from_list(&[(0, 0), (10, 10), (20, 20), (30, 30)]); let mut nodes = Node::linked_list(nodes); let path = Network::new(nodes).path("A", "D").unwrap(); assert_eq!(path.len(), 4);
pub fn path_rev<'a>(&'a self, a: &str, b: &str) -> Result<Vec<Node>>
[src]
Mimics path behaviour but works in reverse, Meaning stepping back in the links.
pub fn get(&self, element: &str) -> Option<Node>
[src]
Returns if the given hash exists in the network.
Examples
let nodes = Node::from_list(&[(0, 0), (10, 10), (20, 20), (30, 30), (40, 40)]); let network = Network::new(nodes.clone()); assert!(network.get("A").is_some()); assert!(network.get("F").is_none());
Trait Implementations
impl<T: Copy + Draw + Hash + Copy> Copy for Network<T>
[src]
impl<T: Clone + Draw + Hash + Copy> Clone for Network<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.