[−][src]Struct math2d::Vector2i
Mathematical vector on the 2D (x, y) plane.
Fields
x: i32
Horizontal component.
y: i32
Vertical component.
Methods
impl Vector2i
[src]
pub const ZERO: Vector2i
[src]
The zero vector. Addition with the zero vector is the identity function.
pub fn new(x: i32, y: i32) -> Self
[src]
Construct a vector from the components
pub fn to_f32(self) -> Vector2f
[src]
Converts this vector to floating point components.
pub fn as_size(self) -> Sizeu
[src]
Converts this vector to a size. Ensure the values are positive or you will experience casting underflow.
pub fn abs(self) -> Vector2i
[src]
Returns the absolute values of the components.
Trait Implementations
impl PartialEq<Vector2i> for Vector2i
[src]
impl Default for Vector2i
[src]
impl Clone for Vector2i
[src]
fn clone(&self) -> Vector2i
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<[i32; 2]> for Vector2i
[src]
impl From<Vector2i> for [i32; 2]
[src]
impl From<Vector2i> for Vector2<i32>
[src]
impl From<Vector2<i32>> for Vector2i
[src]
impl Eq for Vector2i
[src]
impl Copy for Vector2i
[src]
impl Add<Point2i> for Vector2i
[src]
type Output = Point2i
The resulting type after applying the +
operator.
fn add(self, rhs: Point2i) -> Point2i
[src]
impl Add<(i32, i32)> for Vector2i
[src]
type Output = Point2i
The resulting type after applying the +
operator.
fn add(self, rhs: (i32, i32)) -> Point2i
[src]
impl<V> Add<V> for Vector2i where
V: Into<Vector2i>,
[src]
V: Into<Vector2i>,
type Output = Vector2i
The resulting type after applying the +
operator.
fn add(self, rhs: V) -> Vector2i
[src]
impl<V> Sub<V> for Vector2i where
V: Into<Vector2i>,
[src]
V: Into<Vector2i>,
type Output = Vector2i
The resulting type after applying the -
operator.
fn sub(self, rhs: V) -> Vector2i
[src]
impl Mul<i32> for Vector2i
[src]
type Output = Vector2i
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Vector2i
[src]
impl Mul<Vector2i> for i32
[src]
type Output = Vector2i
The resulting type after applying the *
operator.
fn mul(self, rhs: Vector2i) -> Vector2i
[src]
impl Div<i32> for Vector2i
[src]
type Output = Vector2i
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Vector2i
[src]
impl Div<Vector2i> for i32
[src]
type Output = Vector2i
The resulting type after applying the /
operator.
fn div(self, rhs: Vector2i) -> Vector2i
[src]
impl Neg for Vector2i
[src]
type Output = Vector2i
The resulting type after applying the -
operator.
fn neg(self) -> Vector2i
[src]
impl<V> AddAssign<V> for Vector2i where
Vector2i: Add<V, Output = Vector2i>,
[src]
Vector2i: Add<V, Output = Vector2i>,
fn add_assign(&mut self, v: V)
[src]
impl<V> SubAssign<V> for Vector2i where
Vector2i: Sub<V, Output = Vector2i>,
[src]
Vector2i: Sub<V, Output = Vector2i>,
fn sub_assign(&mut self, v: V)
[src]
impl<V> MulAssign<V> for Vector2i where
Vector2i: Mul<V, Output = Vector2i>,
[src]
Vector2i: Mul<V, Output = Vector2i>,
fn mul_assign(&mut self, v: V)
[src]
impl<V> DivAssign<V> for Vector2i where
Vector2i: Div<V, Output = Vector2i>,
[src]
Vector2i: Div<V, Output = Vector2i>,
fn div_assign(&mut self, v: V)
[src]
impl Debug for Vector2i
[src]
impl Serialize for Vector2i
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Vector2i
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,