Struct grid2d::Coordinate
source · [−]pub struct Coordinate { /* private fields */ }Expand description
Coordinate of a cell on a two-dimensional grid
Implementations
sourceimpl Coordinate
impl Coordinate
sourcepub fn from_width_and_index(width: usize, index: usize) -> Self
pub fn from_width_and_index(width: usize, index: usize) -> Self
Creates a coordinate from a grid’s width and a total index
Arguments
width- The grid’s widthindex- The index of the cell
sourcepub fn from_str_pair((x, y): (&str, &str)) -> Result<Self, CoordinateParseError>
pub fn from_str_pair((x, y): (&str, &str)) -> Result<Self, CoordinateParseError>
Creates a coordinate from a tuple of two string slices on success or returns an error code
Arguments
(x, y)- Tuple of the x and y component as string slices
sourcepub fn neighbors(&self) -> Vec<Coordinate>
pub fn neighbors(&self) -> Vec<Coordinate>
Returns all potential neighboring coordinates
Trait Implementations
sourceimpl Clone for Coordinate
impl Clone for Coordinate
sourcefn clone(&self) -> Coordinate
fn clone(&self) -> Coordinate
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for Coordinate
impl Debug for Coordinate
sourceimpl Display for Coordinate
impl Display for Coordinate
sourceimpl From<&(usize, usize)> for Coordinate
impl From<&(usize, usize)> for Coordinate
sourceimpl From<&Coordinate> for (usize, usize)
impl From<&Coordinate> for (usize, usize)
sourcefn from(coordinate: &Coordinate) -> Self
fn from(coordinate: &Coordinate) -> Self
Converts to this type from the input type.
sourceimpl From<&Coordinate> for Coordinate
impl From<&Coordinate> for Coordinate
sourcefn from(coordinate: &Coordinate) -> Self
fn from(coordinate: &Coordinate) -> Self
Converts to this type from the input type.
sourceimpl From<(usize, usize)> for Coordinate
impl From<(usize, usize)> for Coordinate
sourceimpl From<Coordinate> for (usize, usize)
impl From<Coordinate> for (usize, usize)
sourcefn from(coordinate: Coordinate) -> Self
fn from(coordinate: Coordinate) -> Self
Converts to this type from the input type.
sourceimpl FromStr for Coordinate
impl FromStr for Coordinate
sourceimpl Hash for Coordinate
impl Hash for Coordinate
sourceimpl PartialEq<Coordinate> for Coordinate
impl PartialEq<Coordinate> for Coordinate
sourcefn eq(&self, other: &Coordinate) -> bool
fn eq(&self, other: &Coordinate) -> bool
impl Copy for Coordinate
impl Eq for Coordinate
impl StructuralEq for Coordinate
impl StructuralPartialEq for Coordinate
Auto Trait Implementations
impl RefUnwindSafe for Coordinate
impl Send for Coordinate
impl Sync for Coordinate
impl Unpin for Coordinate
impl UnwindSafe for Coordinate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more