Struct slender_math::Vector2i

source ·
#[repr(C, align(8))]
pub struct Vector2i(_);
Expand description

A vector with 2 i32 components

Implementations§

source§

impl Vector2i

source

pub const ZERO: Self = _

The vector (0, 0)

source

pub const fn x(&self) -> i32

The x component of the vector

source

pub fn x_mut(&mut self) -> &mut i32

The x component of the vector

source

pub const fn y(&self) -> i32

The y component of the vector

source

pub fn y_mut(&mut self) -> &mut i32

The y component of the vector

source

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

Creates a new vector from the given components

source

pub const fn from_scalar(scalar: i32) -> Self

Creates a new vector by setting all components to the given scalar

source

pub const fn from_array(array: [i32; 2]) -> Self

Creates a new vector from the given array

source

pub const fn to_array(&self) -> [i32; 2]

Converts the vector into an array

source

pub fn to_float(&self) -> Vector2f

Casts this vector into a floating point vector

source

pub const fn as_array(&self) -> &[i32; 2]

Returns an array reference to the vector

source

pub fn as_mut_array(&mut self) -> &mut [i32; 2]

Returns a mutable array reference to the vector

source§

impl Vector2i

source

pub fn abs(self) -> Self

Returns a vector with each component set to the absolute value of the corresponding component in this vector

source

pub fn min(self, rhs: Self) -> Self

Returns a vector with each component set to the minimum of the corresponding components between this vector and rhs

source

pub fn max(self, rhs: Self) -> Self

Returns a vector with each component set to the maximum of the corresponding components between this vector and rhs

§

impl Vector2i

pub fn xx(&self) -> Vector2i

pub fn xy(&self) -> Vector2i

pub fn yx(&self) -> Vector2i

pub fn yy(&self) -> Vector2i

pub fn xxx(&self) -> Vector3i

pub fn xxy(&self) -> Vector3i

pub fn xyx(&self) -> Vector3i

pub fn xyy(&self) -> Vector3i

pub fn yxx(&self) -> Vector3i

pub fn yxy(&self) -> Vector3i

pub fn yyx(&self) -> Vector3i

pub fn yyy(&self) -> Vector3i

pub fn xxxx(&self) -> Vector4i

pub fn xxxy(&self) -> Vector4i

pub fn xxyx(&self) -> Vector4i

pub fn xxyy(&self) -> Vector4i

pub fn xyxx(&self) -> Vector4i

pub fn xyxy(&self) -> Vector4i

pub fn xyyx(&self) -> Vector4i

pub fn xyyy(&self) -> Vector4i

pub fn yxxx(&self) -> Vector4i

pub fn yxxy(&self) -> Vector4i

pub fn yxyx(&self) -> Vector4i

pub fn yxyy(&self) -> Vector4i

pub fn yyxx(&self) -> Vector4i

pub fn yyxy(&self) -> Vector4i

pub fn yyyx(&self) -> Vector4i

pub fn yyyy(&self) -> Vector4i

Trait Implementations§

source§

impl Add<Vector2i> for Vector2i

§

type Output = Vector2i

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Add<i32> for Vector2i

§

type Output = Vector2i

The resulting type after applying the + operator.
source§

fn add(self, rhs: i32) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Vector2i> for Vector2i

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl AddAssign<i32> for Vector2i

source§

fn add_assign(&mut self, rhs: i32)

Performs the += operation. Read more
source§

impl AsMut<[i32; 2]> for Vector2i

source§

fn as_mut(&mut self) -> &mut [i32; 2]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[i32; 2]> for Vector2i

source§

fn as_ref(&self) -> &[i32; 2]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<[i32; 2]> for Vector2i

source§

fn borrow(&self) -> &[i32; 2]

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<[i32; 2]> for Vector2i

source§

fn borrow_mut(&mut self) -> &mut [i32; 2]

Mutably borrows from an owned value. Read more
source§

impl Clone for Vector2i

source§

fn clone(&self) -> Vector2i

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 Vector2i

source§

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

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

impl Display for Vector2i

source§

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

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

impl Div<Vector2i> for Vector2i

§

type Output = Vector2i

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl Div<i32> for Vector2i

§

type Output = Vector2i

The resulting type after applying the / operator.
source§

fn div(self, rhs: i32) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<Vector2i> for Vector2i

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl DivAssign<i32> for Vector2i

source§

fn div_assign(&mut self, rhs: i32)

Performs the /= operation. Read more
source§

impl From<[i32; 2]> for Vector2i

source§

fn from(a: [i32; 2]) -> Self

Converts to this type from the input type.
source§

impl Hash for Vector2i

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Index<usize> for Vector2i

§

type Output = i32

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Vector2i

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Into<[i32; 2]> for Vector2i

source§

fn into(self) -> [i32; 2]

Converts this type into the (usually inferred) input type.
source§

impl Mul<Vector2i> for Vector2i

§

type Output = Vector2i

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<i32> for Vector2i

§

type Output = Vector2i

The resulting type after applying the * operator.
source§

fn mul(self, rhs: i32) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<Vector2i> for Vector2i

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl MulAssign<i32> for Vector2i

source§

fn mul_assign(&mut self, rhs: i32)

Performs the *= operation. Read more
source§

impl Neg for Vector2i

§

type Output = Vector2i

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq<Vector2i> for Vector2i

source§

fn eq(&self, other: &Vector2i) -> 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 Rem<Vector2i> for Vector2i

§

type Output = Vector2i

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<i32> for Vector2i

§

type Output = Vector2i

The resulting type after applying the % operator.
source§

fn rem(self, rhs: i32) -> Self::Output

Performs the % operation. Read more
source§

impl RemAssign<Vector2i> for Vector2i

source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
source§

impl RemAssign<i32> for Vector2i

source§

fn rem_assign(&mut self, rhs: i32)

Performs the %= operation. Read more
source§

impl Sub<Vector2i> for Vector2i

§

type Output = Vector2i

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<i32> for Vector2i

§

type Output = Vector2i

The resulting type after applying the - operator.
source§

fn sub(self, rhs: i32) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<Vector2i> for Vector2i

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl SubAssign<i32> for Vector2i

source§

fn sub_assign(&mut self, rhs: i32)

Performs the -= operation. Read more
source§

impl Zeroable for Vector2i

source§

fn zeroed() -> Self

source§

impl Copy for Vector2i

source§

impl Eq for Vector2i

source§

impl Pod for Vector2i

source§

impl StructuralEq for Vector2i

source§

impl StructuralPartialEq for Vector2i

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,