Struct pathfinder::Node [−][src]
pub struct Node<'a> { pub hash: u64, pub geo: Coordinate, pub color: Rgba<u8>, pub radius: Option<u32>, pub connections: Vec<Link<'a, Node<'a>>>, }
A positioned object that can be drawn on an image::ImageBuffer.
Fields
hash: u64
geo: Coordinate
color: Rgba<u8>
radius: Option<u32>
connections: Vec<Link<'a, Node<'a>>>
Methods
impl<'a> Node<'a>
[src]
impl<'a> Node<'a>
pub fn new(name: &str, geo: Coordinate) -> Node<'a>
[src]
pub fn new(name: &str, geo: Coordinate) -> Node<'a>
Constructs a Node struct.
pub fn link(&mut self, other: &'a Node<'a>)
[src]
pub fn link(&mut self, other: &'a Node<'a>)
Links Node self to the provided node's coordinate.
use pathfinder::{Node, Square, Coordinate, Location}; let nodeB: Node = Node::new("B", Coordinate::new(100,100)); let mut nodeA: Node = Node::new("A", Coordinate::new(0,0)); nodeA.link(&nodeB); assert_eq!( nodeA.connections.get(0).unwrap().to.get_coordinate(), nodeB.get_coordinate());
Trait Implementations
impl<'a> PartialEq for Node<'a>
[src]
impl<'a> PartialEq for Node<'a>
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<'a> Clone for Node<'a>
[src]
impl<'a> Clone for Node<'a>
fn clone(&self) -> Node<'a>
[src]
fn clone(&self) -> Node<'a>
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<'a> Debug for Node<'a>
[src]
impl<'a> Debug for Node<'a>
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<'a> Location for Node<'a>
[src]
impl<'a> Location for Node<'a>
fn get_coordinate(&self) -> &Coordinate
[src]
fn get_coordinate(&self) -> &Coordinate
impl<'a> Draw for Node<'a>
[src]
impl<'a> Draw for Node<'a>
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) -> &Vec<Link<Node>>
[src]
fn get_links(&self) -> &Vec<Link<Node>>
impl<'a> Hash for Node<'a>
[src]
impl<'a> Hash for Node<'a>