[][src]Struct launchy::Pad

pub struct Pad {
    pub x: i32,
    pub y: i32,
}

A 2d point that represents a single pad on a grid of pads. For convenience, the coordinates can be negative.

Pad implements various mathematical operator traits for the (i32, i32) tuple. Therefore it's possible move a pad around by adding or subtracting (x, y) coordinate tuples:

let pad = Pad { x: 3, y: 6 };
 
assert_eq!(pad + (4, 4), Pad { x: 7, y: 10 });
assert_eq!(pad - (4, 4), Pad { x: -1, y: 2 });

Fields

x: i32y: i32

Implementations

impl Pad[src]

pub fn up(self, steps: i32) -> Self[src]

Return a copy of this Pad, moved upwards by a certain number of steps

pub fn down(self, steps: i32) -> Self[src]

Return a copy of this Pad, moved downwards by a certain number of steps

pub fn left(self, steps: i32) -> Self[src]

Return a copy of this Pad, moved left by a certain number of steps

pub fn right(self, steps: i32) -> Self[src]

Return a copy of this Pad, moved right by a certain number of steps

pub fn neighbors_4(self) -> [Self; 4][src]

Returns an array of the four surrounding neighbors of this pad

pub fn neighbors_5(self) -> [Self; 5][src]

Returns an array of the four surrounding neighbors of this pad, plus itself

pub fn neighbors_8(self) -> [Self; 8][src]

Returns an array of the eight surrounding neighbors of this pad

pub fn neighbors_9(self) -> [Self; 9][src]

Returns an array of the eight surrounding neighbors of this pad, plus itself

Trait Implementations

impl Add<(i32, i32)> for Pad[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<(i32, i32)> for Pad[src]

impl Clone for Pad[src]

impl Copy for Pad[src]

impl Debug for Pad[src]

impl Default for Pad[src]

impl Eq for Pad[src]

impl Hash for Pad[src]

impl<'a> Index<Pad> for CanvasLayout<'a>[src]

type Output = Color

The returned type after indexing.

impl<S: DeviceSpec> Index<Pad> for DeviceCanvas<S>[src]

type Output = Color

The returned type after indexing.

impl<C: Canvas> Index<Pad> for PaddingCanvas<C>[src]

type Output = Color

The returned type after indexing.

impl<'a> IndexMut<Pad> for CanvasLayout<'a>[src]

impl<S: DeviceSpec> IndexMut<Pad> for DeviceCanvas<S>[src]

impl<C: Canvas> IndexMut<Pad> for PaddingCanvas<C>[src]

impl PartialEq<Pad> for Pad[src]

impl StructuralEq for Pad[src]

impl StructuralPartialEq for Pad[src]

impl Sub<(i32, i32)> for Pad[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<(i32, i32)> for Pad[src]

Auto Trait Implementations

impl RefUnwindSafe for Pad

impl Send for Pad

impl Sync for Pad

impl Unpin for Pad

impl UnwindSafe for Pad

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.