Struct airmash_protocol::Vector2 [−][src]
pub struct Vector2<T> { pub x: T, pub y: T, }
Fields
x: T
y: T
Methods
impl<T> Vector2<T>
[src]
impl<T> Vector2<T>
pub fn new<X>(x: X, y: X) -> Self where
X: Into<T>,
[src]
pub fn new<X>(x: X, y: X) -> Self where
X: Into<T>,
pub fn dot<U>(self, rhs: Vector2<U>) -> <<T as Mul<U>>::Output as Add>::Output where
T: Mul<U>,
<T as Mul<U>>::Output: Add,
[src]
pub fn dot<U>(self, rhs: Vector2<U>) -> <<T as Mul<U>>::Output as Add>::Output where
T: Mul<U>,
<T as Mul<U>>::Output: Add,
pub fn length(self) -> <<<T as Mul>::Output as Add>::Output as Sqrt>::Output where
Self: Clone,
T: Mul,
T::Output: Add,
<T::Output as Add>::Output: Sqrt,
[src]
pub fn length(self) -> <<<T as Mul>::Output as Add>::Output as Sqrt>::Output where
Self: Clone,
T: Mul,
T::Output: Add,
<T::Output as Add>::Output: Sqrt,
pub fn length2(self) -> <<T as Mul>::Output as Add>::Output where
Self: Clone,
T: Mul,
T::Output: Add,
[src]
pub fn length2(self) -> <<T as Mul>::Output as Add>::Output where
Self: Clone,
T: Mul,
T::Output: Add,
pub fn normalized(
self
) -> Vector2<<T as Div<<<<T as Mul>::Output as Add>::Output as Sqrt>::Output>>::Output> where
Self: Clone,
T: Mul + Div<<<<T as Mul>::Output as Add>::Output as Sqrt>::Output>,
<T as Mul>::Output: Add,
<<T as Mul>::Output as Add>::Output: Sqrt,
<<<T as Mul>::Output as Add>::Output as Sqrt>::Output: Clone + NotVec,
[src]
pub fn normalized(
self
) -> Vector2<<T as Div<<<<T as Mul>::Output as Add>::Output as Sqrt>::Output>>::Output> where
Self: Clone,
T: Mul + Div<<<<T as Mul>::Output as Add>::Output as Sqrt>::Output>,
<T as Mul>::Output: Add,
<<T as Mul>::Output as Add>::Output: Sqrt,
<<<T as Mul>::Output as Add>::Output as Sqrt>::Output: Clone + NotVec,
Trait Implementations
impl<T: Default> Default for Vector2<T>
[src]
impl<T: Default> Default for Vector2<T>
impl<T: Clone> Clone for Vector2<T>
[src]
impl<T: Clone> Clone for Vector2<T>
fn clone(&self) -> Vector2<T>
[src]
fn clone(&self) -> Vector2<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Copy> Copy for Vector2<T>
[src]
impl<T: Copy> Copy for Vector2<T>
impl<T: PartialEq> PartialEq for Vector2<T>
[src]
impl<T: PartialEq> PartialEq for Vector2<T>
fn eq(&self, other: &Vector2<T>) -> bool
[src]
fn eq(&self, other: &Vector2<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vector2<T>) -> bool
[src]
fn ne(&self, other: &Vector2<T>) -> bool
This method tests for !=
.
impl<T: Debug> Debug for Vector2<T>
[src]
impl<T: Debug> Debug for Vector2<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T, U> Add<U> for Vector2<T> where
T: Add<U>,
U: Clone + NotVec,
[src]
impl<T, U> Add<U> for Vector2<T> where
T: Add<U>,
U: Clone + NotVec,
type Output = Vector2<T::Output>
The resulting type after applying the +
operator.
fn add(self, rhs: U) -> Self::Output
[src]
fn add(self, rhs: U) -> Self::Output
Performs the +
operation.
impl<T, U> Sub<U> for Vector2<T> where
T: Sub<U>,
U: Clone + NotVec,
[src]
impl<T, U> Sub<U> for Vector2<T> where
T: Sub<U>,
U: Clone + NotVec,
type Output = Vector2<T::Output>
The resulting type after applying the -
operator.
fn sub(self, rhs: U) -> Self::Output
[src]
fn sub(self, rhs: U) -> Self::Output
Performs the -
operation.
impl<T, U> Mul<U> for Vector2<T> where
T: Mul<U>,
U: Clone + NotVec,
[src]
impl<T, U> Mul<U> for Vector2<T> where
T: Mul<U>,
U: Clone + NotVec,
type Output = Vector2<T::Output>
The resulting type after applying the *
operator.
fn mul(self, rhs: U) -> Self::Output
[src]
fn mul(self, rhs: U) -> Self::Output
Performs the *
operation.
impl<T, U> Div<U> for Vector2<T> where
T: Div<U>,
U: Clone + NotVec,
[src]
impl<T, U> Div<U> for Vector2<T> where
T: Div<U>,
U: Clone + NotVec,
type Output = Vector2<T::Output>
The resulting type after applying the /
operator.
fn div(self, rhs: U) -> Self::Output
[src]
fn div(self, rhs: U) -> Self::Output
Performs the /
operation.
impl<T, U> Add<Vector2<U>> for Vector2<T> where
T: Add<U>,
[src]
impl<T, U> Add<Vector2<U>> for Vector2<T> where
T: Add<U>,
type Output = Vector2<T::Output>
The resulting type after applying the +
operator.
fn add(self, rhs: Vector2<U>) -> Self::Output
[src]
fn add(self, rhs: Vector2<U>) -> Self::Output
Performs the +
operation.
impl<T, U> Sub<Vector2<U>> for Vector2<T> where
T: Sub<U>,
[src]
impl<T, U> Sub<Vector2<U>> for Vector2<T> where
T: Sub<U>,
type Output = Vector2<T::Output>
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector2<U>) -> Self::Output
[src]
fn sub(self, rhs: Vector2<U>) -> Self::Output
Performs the -
operation.
impl<T, U> Mul<Vector2<U>> for Vector2<T> where
T: Mul<U>,
[src]
impl<T, U> Mul<Vector2<U>> for Vector2<T> where
T: Mul<U>,
type Output = Vector2<T::Output>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vector2<U>) -> Self::Output
[src]
fn mul(self, rhs: Vector2<U>) -> Self::Output
Performs the *
operation.
impl<T, U> AddAssign<U> for Vector2<T> where
Self: Add<U, Output = Vector2<T>> + Clone,
[src]
impl<T, U> AddAssign<U> for Vector2<T> where
Self: Add<U, Output = Vector2<T>> + Clone,
fn add_assign(&mut self, rhs: U)
[src]
fn add_assign(&mut self, rhs: U)
Performs the +=
operation.
impl<T, U> SubAssign<U> for Vector2<T> where
Self: Sub<U, Output = Vector2<T>> + Clone,
[src]
impl<T, U> SubAssign<U> for Vector2<T> where
Self: Sub<U, Output = Vector2<T>> + Clone,
fn sub_assign(&mut self, rhs: U)
[src]
fn sub_assign(&mut self, rhs: U)
Performs the -=
operation.
impl<T, U> MulAssign<U> for Vector2<T> where
Self: Mul<U, Output = Vector2<T>> + Clone,
[src]
impl<T, U> MulAssign<U> for Vector2<T> where
Self: Mul<U, Output = Vector2<T>> + Clone,
fn mul_assign(&mut self, rhs: U)
[src]
fn mul_assign(&mut self, rhs: U)
Performs the *=
operation.
impl<T, U> DivAssign<U> for Vector2<T> where
Self: Div<U, Output = Vector2<T>> + Clone,
[src]
impl<T, U> DivAssign<U> for Vector2<T> where
Self: Div<U, Output = Vector2<T>> + Clone,
fn div_assign(&mut self, rhs: U)
[src]
fn div_assign(&mut self, rhs: U)
Performs the /=
operation.
impl<T: 'static + Send + Sync> Component for Vector2<T>
[src]
impl<T: 'static + Send + Sync> Component for Vector2<T>
type Storage = VecStorage<Vector2<T>>
Associated storage type for this component.