Struct texel_types::Position2D

source ·
pub struct Position2D {
    pub x: i32,
    pub y: i32,
}
Expand description

2D position

Fields§

§x: i32§y: i32

Implementations§

source§

impl Position2D

source

pub fn from_xy(x: i32, y: i32) -> Self

source

pub fn apply(&mut self, translation: Translation, bounds: Bounds) -> bool

Applies given Translation to this Position2D with regards to the provided Bounds area. If Bounds is binding ensures position does not reach outside.

source

pub fn area(self, other: Position2D) -> Bounds

Create bounds from two points

source

pub fn area_texels(self, dim: Dimension) -> Vec<Position2D>

Create the list of all positions in given area from point with given dimension

Trait Implementations§

source§

impl Add<Position2D> for Position

§

type Output = Position

The resulting type after applying the + operator.
source§

fn add(self, other: Position2D) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Position2D

§

type Output = Position2D

The resulting type after applying the + operator.
source§

fn add(self, other: Position2D) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Position2D> for Position

source§

fn add_assign(&mut self, other: Position2D)

Performs the += operation. Read more
source§

impl AddAssign for Position2D

source§

fn add_assign(&mut self, other: Position2D)

Performs the += operation. Read more
source§

impl Clone for Position2D

source§

fn clone(&self) -> Position2D

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Position2D

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Position2D

source§

fn default() -> Position2D

Returns the “default value” for a type. Read more
source§

impl Display for Position2D

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Position> for Position2D

source§

fn from(pos: &Position) -> Position2D

Converts to this type from the input type.
source§

impl From<&mut Position> for Position2D

source§

fn from(pos: &mut Position) -> Position2D

Converts to this type from the input type.
source§

impl From<Position> for Position2D

source§

fn from(pos: Position) -> Position2D

Converts to this type from the input type.
source§

impl PartialEq for Position2D

source§

fn eq(&self, other: &Position2D) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Position> for Position2D

§

type Output = Position2D

The resulting type after applying the - operator.
source§

fn sub(self, other: Position) -> Self

Performs the - operation. Read more
source§

impl Sub<Position2D> for Bounds

§

type Output = Bounds

The resulting type after applying the - operator.
source§

fn sub(self, other: Position2D) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Position2D

§

type Output = Position2D

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign for Position2D

source§

fn sub_assign(&mut self, other: Position2D)

Performs the -= operation. Read more
source§

impl Copy for Position2D

source§

impl Eq for Position2D

source§

impl StructuralPartialEq for Position2D

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.