Struct pathfinder::Node [−][src]
pub struct Node { pub hash: u64, pub geo: Coordinate, pub color: Rgba<u8>, pub radius: Option<u32>, // some fields omitted }
A positioned object that can be drawn on an image::ImageBuffer.
Fields
hash: u64
geo: Coordinate
color: Rgba<u8>
radius: Option<u32>
Methods
impl Node
[src]
impl Node
pub fn new(name: &str, geo: Coordinate) -> Node
[src]
pub fn new(name: &str, geo: Coordinate) -> Node
Constructs a Node struct.
pub fn from_list(list: &[(i16, i16)]) -> Vec<Node>
[src]
pub fn from_list(list: &[(i16, i16)]) -> Vec<Node>
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);
pub fn is_directly_connected(&self, other: &Node) -> bool
[src]
pub fn is_directly_connected(&self, other: &Node) -> bool
Looks through all connected Nodes and returns if they are connected.
pub fn linked_list(list: Vec<Node>) -> Vec<Node>
[src]
pub fn linked_list(list: Vec<Node>) -> Vec<Node>
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);
pub fn link(&mut self, other: &Node)
[src]
pub fn link(&mut self, other: &Node)
Links Node self to the provided node's coordinate.
use pathfinder::{Node, Coordinate, Location}; 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_eq!(a.is_directly_connected(&b), true);
Trait Implementations
impl<'a> PartialEq for Node
[src]
impl<'a> PartialEq for Node
fn eq(&self, other: &Node) -> bool
[src]
fn eq(&self, other: &Node) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]This method tests for !=
.
impl Copy for Node
[src]
impl Copy for Node
impl Clone for Node
[src]
impl Clone for Node
fn clone(&self) -> Node
[src]
fn clone(&self) -> Node
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Debug for Node
[src]
impl Debug for Node
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Location for Node
[src]
impl Location for Node
fn get_coordinate(&self) -> Coordinate
[src]
fn get_coordinate(&self) -> Coordinate
fn get_parameters(&self) -> (Coordinate, Coordinate)
[src]
fn get_parameters(&self) -> (Coordinate, Coordinate)
fn find(&self, hash: u64) -> Option<Coordinate>
[src]
fn find(&self, hash: u64) -> Option<Coordinate>
impl Draw for Node
[src]
impl Draw for Node
fn draw<S: Shape>(
&self,
image: ImageBuffer<Rgba<u8>, Vec<u8>>,
x_offset: i16,
y_offset: i16,
size: u32,
shape: &S
) -> ImageBuffer<Rgba<u8>, Vec<u8>>
[src]
fn draw<S: Shape>(
&self,
image: ImageBuffer<Rgba<u8>, Vec<u8>>,
x_offset: i16,
y_offset: i16,
size: u32,
shape: &S
) -> ImageBuffer<Rgba<u8>, Vec<u8>>
fn get_size(&self) -> u32
[src]
fn get_size(&self) -> u32
fn get_links(&self) -> &[HashLink]
[src]
fn get_links(&self) -> &[HashLink]
impl Hash for Node
[src]
impl Hash for Node