[−][src]Struct launchy::Pad
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: i32
y: 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.
fn add(self, offset: (i32, i32)) -> Self
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Index<Pad> for CanvasLayout<'a>
[src]
impl<S: DeviceSpec> Index<Pad> for DeviceCanvas<S>
[src]
impl<C: Canvas> Index<Pad> for PaddingCanvas<C>
[src]
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.
fn sub(self, offset: (i32, i32)) -> Self
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,