Struct Vec2
#[repr(C)]pub struct Vec2<T> {
pub x: T,
pub y: T,
}Fields§
§x: T§y: TImplementations§
§impl<T> Vec2<T>
impl<T> Vec2<T>
pub const fn new(x: T, y: T) -> Vec2<T>
pub const fn as_array(&self) -> &[T; 2]
pub const fn as_array_mut(&mut self) -> &mut [T; 2]
pub const fn from_array_ref(a: &[T; 2]) -> &Vec2<T>
pub const fn from_array_mut(a: &mut [T; 2]) -> &mut Vec2<T>
pub const fn into_array(self) -> [T; 2]
pub const fn from_array(a: [T; 2]) -> Vec2<T>
pub fn from_fn(f: impl FnMut(usize) -> T) -> Vec2<T>
pub fn map<U>(self, f: impl Fn(T) -> U) -> Vec2<U>
pub fn zip<U, R>(self, rhs: Vec2<U>, f: impl Fn(&T, &U) -> R) -> Vec2<R>
§impl<T> Vec2<T>where
T: Primitive,
impl<T> Vec2<T>where
T: Primitive,
pub const fn into_array_const(self) -> [T; 2]
pub const fn from_array_const(a: [T; 2]) -> Vec2<T>
§impl<T> Vec2<T>where
T: Number,
impl<T> Vec2<T>where
T: Number,
pub fn sum(self) -> T
pub fn dot(self, rhs: Vec2<T>) -> T
pub fn length_sq(self) -> T
pub fn length(self) -> f64
pub fn normalized(self) -> Vec2<T>
pub fn lerp(self, b: Vec2<T>, t: T) -> Vec2<T>
pub fn lerp_separately(self, b: Vec2<T>, t: Vec2<T>) -> Vec2<T>
pub fn inv_lerp(self, b: Vec2<T>, x: Vec2<T>) -> T
§impl<T> Vec2<T>where
T: Copy,
impl<T> Vec2<T>where
T: Copy,
pub fn xxx(&self) -> Vec3<T>
pub fn xxy(&self) -> Vec3<T>
pub fn xxn(&self, z: T) -> Vec3<T>
pub fn xyx(&self) -> Vec3<T>
pub fn xyy(&self) -> Vec3<T>
pub fn xyn(&self, z: T) -> Vec3<T>
pub fn xnx(&self, y: T) -> Vec3<T>
pub fn xny(&self, y: T) -> Vec3<T>
pub fn xnn(&self, y: T, z: T) -> Vec3<T>
pub fn yxx(&self) -> Vec3<T>
pub fn yxy(&self) -> Vec3<T>
pub fn yxn(&self, z: T) -> Vec3<T>
pub fn yyx(&self) -> Vec3<T>
pub fn yyy(&self) -> Vec3<T>
pub fn yyn(&self, z: T) -> Vec3<T>
pub fn ynx(&self, y: T) -> Vec3<T>
pub fn yny(&self, y: T) -> Vec3<T>
pub fn ynn(&self, y: T, z: T) -> Vec3<T>
pub fn nxx(&self, x: T) -> Vec3<T>
pub fn nxy(&self, x: T) -> Vec3<T>
pub fn nxn(&self, x: T, z: T) -> Vec3<T>
pub fn nyx(&self, x: T) -> Vec3<T>
pub fn nyy(&self, x: T) -> Vec3<T>
pub fn nyn(&self, x: T, z: T) -> Vec3<T>
pub fn nnx(&self, x: T, y: T) -> Vec3<T>
pub fn nny(&self, x: T, y: T) -> Vec3<T>
§impl<T> Vec2<T>where
T: Copy,
impl<T> Vec2<T>where
T: Copy,
pub fn xxxx(&self) -> Vec4<T>
pub fn xxxy(&self) -> Vec4<T>
pub fn xxxn(&self, w: T) -> Vec4<T>
pub fn xxyx(&self) -> Vec4<T>
pub fn xxyy(&self) -> Vec4<T>
pub fn xxyn(&self, w: T) -> Vec4<T>
pub fn xxnx(&self, z: T) -> Vec4<T>
pub fn xxny(&self, z: T) -> Vec4<T>
pub fn xxnn(&self, z: T, w: T) -> Vec4<T>
pub fn xyxx(&self) -> Vec4<T>
pub fn xyxy(&self) -> Vec4<T>
pub fn xyxn(&self, w: T) -> Vec4<T>
pub fn xyyx(&self) -> Vec4<T>
pub fn xyyy(&self) -> Vec4<T>
pub fn xyyn(&self, w: T) -> Vec4<T>
pub fn xynx(&self, z: T) -> Vec4<T>
pub fn xyny(&self, z: T) -> Vec4<T>
pub fn xynn(&self, z: T, w: T) -> Vec4<T>
pub fn xnxx(&self, y: T) -> Vec4<T>
pub fn xnxy(&self, y: T) -> Vec4<T>
pub fn xnxn(&self, y: T, w: T) -> Vec4<T>
pub fn xnyx(&self, y: T) -> Vec4<T>
pub fn xnyy(&self, y: T) -> Vec4<T>
pub fn xnyn(&self, y: T, w: T) -> Vec4<T>
pub fn xnnx(&self, y: T, z: T) -> Vec4<T>
pub fn xnny(&self, y: T, z: T) -> Vec4<T>
pub fn xnnn(&self, y: T, z: T, w: T) -> Vec4<T>
pub fn yxxx(&self) -> Vec4<T>
pub fn yxxy(&self) -> Vec4<T>
pub fn yxxn(&self, w: T) -> Vec4<T>
pub fn yxyx(&self) -> Vec4<T>
pub fn yxyy(&self) -> Vec4<T>
pub fn yxyn(&self, w: T) -> Vec4<T>
pub fn yxnx(&self, z: T) -> Vec4<T>
pub fn yxny(&self, z: T) -> Vec4<T>
pub fn yxnn(&self, z: T, w: T) -> Vec4<T>
pub fn yyxx(&self) -> Vec4<T>
pub fn yyxy(&self) -> Vec4<T>
pub fn yyxn(&self, w: T) -> Vec4<T>
pub fn yyyx(&self) -> Vec4<T>
pub fn yyyy(&self) -> Vec4<T>
pub fn yyyn(&self, w: T) -> Vec4<T>
pub fn yynx(&self, z: T) -> Vec4<T>
pub fn yyny(&self, z: T) -> Vec4<T>
pub fn yynn(&self, z: T, w: T) -> Vec4<T>
pub fn ynxx(&self, y: T) -> Vec4<T>
pub fn ynxy(&self, y: T) -> Vec4<T>
pub fn ynxn(&self, y: T, w: T) -> Vec4<T>
pub fn ynyx(&self, y: T) -> Vec4<T>
pub fn ynyy(&self, y: T) -> Vec4<T>
pub fn ynyn(&self, y: T, w: T) -> Vec4<T>
pub fn ynnx(&self, y: T, z: T) -> Vec4<T>
pub fn ynny(&self, y: T, z: T) -> Vec4<T>
pub fn ynnn(&self, y: T, z: T, w: T) -> Vec4<T>
pub fn nxxx(&self, x: T) -> Vec4<T>
pub fn nxxy(&self, x: T) -> Vec4<T>
pub fn nxxn(&self, x: T, w: T) -> Vec4<T>
pub fn nxyx(&self, x: T) -> Vec4<T>
pub fn nxyy(&self, x: T) -> Vec4<T>
pub fn nxyn(&self, x: T, w: T) -> Vec4<T>
pub fn nxnx(&self, x: T, z: T) -> Vec4<T>
pub fn nxny(&self, x: T, z: T) -> Vec4<T>
pub fn nxnn(&self, x: T, z: T, w: T) -> Vec4<T>
pub fn nyxx(&self, x: T) -> Vec4<T>
pub fn nyxy(&self, x: T) -> Vec4<T>
pub fn nyxn(&self, x: T, w: T) -> Vec4<T>
pub fn nyyx(&self, x: T) -> Vec4<T>
pub fn nyyy(&self, x: T) -> Vec4<T>
pub fn nyyn(&self, x: T, w: T) -> Vec4<T>
pub fn nynx(&self, x: T, z: T) -> Vec4<T>
pub fn nyny(&self, x: T, z: T) -> Vec4<T>
pub fn nynn(&self, x: T, z: T, w: T) -> Vec4<T>
pub fn nnxx(&self, x: T, y: T) -> Vec4<T>
pub fn nnxy(&self, x: T, y: T) -> Vec4<T>
pub fn nnxn(&self, x: T, y: T, w: T) -> Vec4<T>
pub fn nnyx(&self, x: T, y: T) -> Vec4<T>
pub fn nnyy(&self, x: T, y: T) -> Vec4<T>
pub fn nnyn(&self, x: T, y: T, w: T) -> Vec4<T>
pub fn nnnx(&self, x: T, y: T, z: T) -> Vec4<T>
pub fn nnny(&self, x: T, y: T, z: T) -> Vec4<T>
Trait Implementations§
§impl<T, U> AddAssign<Vec2<U>> for Vec2<T>where
T: AddAssign<U>,
impl<T, U> AddAssign<Vec2<U>> for Vec2<T>where
T: AddAssign<U>,
§fn add_assign(&mut self, rhs: Vec2<U>)
fn add_assign(&mut self, rhs: Vec2<U>)
Performs the
+= operation. Read moreimpl<T> AllBitVariationsValid for Vec2<T>where
T: AllBitVariationsValid,
impl<T> AllBitsInit for Vec2<T>where
T: AllBitsInit,
impl<T> Copy for Vec2<T>where
T: Copy,
§impl<'de, T> Deserialize<'de> for Vec2<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Vec2<T>where
T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Vec2<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Vec2<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> DivAssign for Vec2<T>where
T: DivAssign,
impl<T> DivAssign for Vec2<T>where
T: DivAssign,
§fn div_assign(&mut self, rhs: Vec2<T>)
fn div_assign(&mut self, rhs: Vec2<T>)
Performs the
/= operation. Read more§impl<T> DivAssign<T> for Vec2<T>
impl<T> DivAssign<T> for Vec2<T>
§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreimpl<T> Eq for Vec2<T>where
T: Eq,
§impl<T> MulAssign for Vec2<T>where
T: MulAssign,
impl<T> MulAssign for Vec2<T>where
T: MulAssign,
§fn mul_assign(&mut self, rhs: Vec2<T>)
fn mul_assign(&mut self, rhs: Vec2<T>)
Performs the
*= operation. Read more§impl<T> MulAssign<T> for Vec2<T>
impl<T> MulAssign<T> for Vec2<T>
§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read more§impl<T> Ord for Vec2<T>where
T: Ord,
impl<T> Ord for Vec2<T>where
T: Ord,
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
§impl<T> PartialOrd for Vec2<T>where
T: PartialOrd,
impl<T> PartialOrd for Vec2<T>where
T: PartialOrd,
§impl<S, T> Serializable<S> for Vec2<T>
impl<S, T> Serializable<S> for Vec2<T>
fn serialize(&self, ctx: SerializerCtx<'_, S>, path: &str) -> SerializedValue
fn deserialize( &mut self, ctx: SerializerCtx<'_, S>, path: &str, value: &SerializedValue, )
§impl<T> Serialize for Vec2<T>where
T: Serialize,
impl<T> Serialize for Vec2<T>where
T: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> StructuralPartialEq for Vec2<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Forget for Vec2<T>
impl<T> Freeze for Vec2<T>where
T: Freeze,
impl<T> Move for Vec2<T>
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> UnsafeUnpin for Vec2<T>where
T: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().