pub struct Vec2<T = usize> {
pub x: T,
pub y: T,
}Expand description
A 2D vector implementing basic operations A 2D vector implementing basic operations
Fields§
§x: T§y: TImplementations§
Source§impl Vec2<usize>
impl Vec2<usize>
Sourcepub fn saturating_sub<T>(&self, rhs: T) -> Selfwhere
T: Into<Self>,
pub fn saturating_sub<T>(&self, rhs: T) -> Selfwhere
T: Into<Self>,
Saturating Vec2 subtraction. Computes self - rhs, saturating at
the numeric bounds instead of overlowing
Sourcepub fn checked_sub<T>(&self, rhs: T) -> Option<Self>where
T: Into<Self>,
pub fn checked_sub<T>(&self, rhs: T) -> Option<Self>where
T: Into<Self>,
Checked Vec2 subtraction. Computes self - rhs, returning None
if overflow occured.
Trait Implementations§
Source§impl<L, R> AddAssign<Vec2<R>> for Vec2<L>where
L: AddAssign<R>,
impl<L, R> AddAssign<Vec2<R>> for Vec2<L>where
L: AddAssign<R>,
Source§fn add_assign(&mut self, rhs: Vec2<R>)
fn add_assign(&mut self, rhs: Vec2<R>)
Performs the
+= operation. Read moreSource§impl<'de, T> Deserialize<'de> for Vec2<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Vec2<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<L, R> DivAssign<Vec2<R>> for Vec2<L>where
L: DivAssign<R>,
impl<L, R> DivAssign<Vec2<R>> for Vec2<L>where
L: DivAssign<R>,
Source§fn div_assign(&mut self, rhs: Vec2<R>)
fn div_assign(&mut self, rhs: Vec2<R>)
Performs the
/= operation. Read moreSource§impl<L, R> MulAssign<Vec2<R>> for Vec2<L>where
L: MulAssign<R>,
impl<L, R> MulAssign<Vec2<R>> for Vec2<L>where
L: MulAssign<R>,
Source§fn mul_assign(&mut self, rhs: Vec2<R>)
fn mul_assign(&mut self, rhs: Vec2<R>)
Performs the
*= operation. Read moreSource§impl<T> Ord for Vec2<T>where
T: PartialOrd + Ord,
impl<T> Ord for Vec2<T>where
T: PartialOrd + Ord,
Source§impl<T> PartialOrd for Vec2<T>where
T: PartialOrd,
impl<T> PartialOrd for Vec2<T>where
T: PartialOrd,
Source§impl<L, R> SubAssign<Vec2<R>> for Vec2<L>where
L: SubAssign<R>,
impl<L, R> SubAssign<Vec2<R>> for Vec2<L>where
L: SubAssign<R>,
Source§fn sub_assign(&mut self, rhs: Vec2<R>)
fn sub_assign(&mut self, rhs: Vec2<R>)
Performs the
-= operation. Read moreimpl<T: Copy> Copy for Vec2<T>
impl<T: Eq> Eq for Vec2<T>
impl<T> StructuralPartialEq for Vec2<T>
Auto Trait Implementations§
impl<T> Freeze for Vec2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec2<T>where
T: RefUnwindSafe,
impl<T> Send for Vec2<T>where
T: Send,
impl<T> Sync for Vec2<T>where
T: Sync,
impl<T> Unpin for Vec2<T>where
T: Unpin,
impl<T> UnwindSafe for Vec2<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more