A Location object that can be drawn on an image, along with set size and
color.
Constructs a Node struct.
Retrive coordinate from a csv format.
Gets the center position of the node accounting for size.
Converts a list of tuples (x,y) to a Vector of Nodes.
Names are assigned from "A" and upwards automatically.
use pathfinder::Node;
let list = [(0, 0), (10, 10), (15, 15)];
let nodes = Node::from_list(&list);
assert_eq!(nodes.len(), 3);
Looks through all connected Nodes and returns if they are connected.
Links a list of nodes together in the order they are indexed.
A list of A, B, C. Will result in them being linked as: A -> B -> C.
let nodes = Node::from_list(&[(0, 0), (20, 20)]);
let linked_list = Node::linked_list(nodes);
Returns a specific link if it exists. Returns none if not.
let node = Node::new("", Coordinate::new(0, 0));
let hl = node.hl(0);
assert!(hl.is_err());
let a = Node::new("A", Coordinate::new(0, 0));
let mut b = Node::new("B", Coordinate::new(50, 50));
b.link(&a);
assert!(b.hl(0).is_ok());
See Node::hl for examples. Returns a mutable variant.
Links a list of nodes together in the order they are indexed.
A list of A, B, C. Will result in them being linked as: A -> B -> C.
use pathfinder::Node;
let nodes = Node::from_list(&[(0, 0), (20, 20)]);
let linked_list = Node::linked_list(nodes);
Returns the next point which is available to link.
let a = Node::new("A", Coordinate::new(0, 0));
let mut b = Node::new("B", Coordinate::new(50, 50));
assert_eq!(b.get_link_avail_index(), 0);
b.link(&a);
assert_eq!(b.get_link_avail_index(), 1);
Removes all connects leaving this node. This still leaves connections
going towards this node.
let a = Node::new("A", Coordinate::new(0, 0));
let mut b = Node::new("B", Coordinate::new(50, 50));
b.link(&a);
assert!(b.hl(0).is_ok());
b.disconnect();
assert!(b.hl(0).is_err());
Links Node self to another point that has Hash and Location implemented.
let b: Node = Node::new("B", Coordinate::new(100, 100));
let mut a: Node = Node::new("A", Coordinate::new(0, 0));
a.link(&b);
assert!(a.is_directly_connected(&b));
Matches the Hashes and returns Some if it matches.
Retrieves the position Coordinates.
Returns if the positions are equal or not.
Retrieves the X coordinate.
Retrieves the Y coordinate.
Returns the sum of the x and y value.
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Sets value
as a parameter of self
.