[][src]Struct line_drawing::WalkGrid

pub struct WalkGrid<T> { /* fields omitted */ }

Walk along a grid, taking only orthogonal steps.

See this section of the article for an interactive demonstration.

Note that this algorithm isn't symetrical; if you swap start and end, the reversed line might not be the same.

Example:

extern crate line_drawing;
use line_drawing::WalkGrid;

fn main() {
    for (x, y) in WalkGrid::new((0, 0), (5, 3)) {
        print!("({}, {}), ", x, y);
    }
}
(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2), (4, 2), (4, 3), (5, 3),

Methods

impl<T: SignedNum> WalkGrid<T>[src]

Important traits for WalkGrid<T>
pub fn new(start: Point<T>, end: Point<T>) -> WalkGrid<T>[src]

Important traits for Steps<T, I>
pub fn steps(self) -> Steps<Point<T>, WalkGrid<T>>[src]

Trait Implementations

impl<T: SignedNum> Iterator for WalkGrid<T>[src]

type Item = Point<T>

The type of the elements being iterated over.

Auto Trait Implementations

impl<T> Send for WalkGrid<T> where
    T: Send

impl<T> Unpin for WalkGrid<T> where
    T: Unpin

impl<T> Sync for WalkGrid<T> where
    T: Sync

impl<T> UnwindSafe for WalkGrid<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for WalkGrid<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]