Skip to main content

Vec2

Struct Vec2 

#[repr(C)]
pub struct Vec2 { pub x: f32, pub y: f32, }
Expand description

A 2-dimensional vector.

Fields§

§x: f32§y: f32

Implementations§

§

impl Vec2

pub const ZERO: Vec2

All zeroes.

pub const ONE: Vec2

All ones.

pub const NEG_ONE: Vec2

All negative ones.

pub const MIN: Vec2

All f32::MIN.

pub const MAX: Vec2

All f32::MAX.

pub const NAN: Vec2

All f32::NAN.

pub const INFINITY: Vec2

All f32::INFINITY.

pub const NEG_INFINITY: Vec2

All f32::NEG_INFINITY.

pub const X: Vec2

A unit vector pointing along the positive X axis.

pub const Y: Vec2

A unit vector pointing along the positive Y axis.

pub const NEG_X: Vec2

A unit vector pointing along the negative X axis.

pub const NEG_Y: Vec2

A unit vector pointing along the negative Y axis.

pub const AXES: [Vec2; 2]

The unit axes.

pub const USES_CORE_SIMD: bool = false

Vec2 uses Rust Portable SIMD

pub const USES_NEON: bool = false

Vec2 uses Arm NEON

pub const USES_SCALAR_MATH: bool = true

Vec2 uses scalar math

pub const USES_SSE2: bool = false

Vec2 uses Intel SSE2

pub const USES_WASM_SIMD: bool = false

Vec2 uses WebAssembly 128-bit SIMD

pub const USES_WASM32_SIMD: bool = false

👎Deprecated since 0.31.0:

Renamed to USES_WASM_SIMD

pub const fn new(x: f32, y: f32) -> Vec2

Creates a new vector.

pub const fn splat(v: f32) -> Vec2

Creates a vector with all elements set to v.

pub fn map<F>(self, f: F) -> Vec2
where F: FnMut(f32) -> f32,

Returns a vector containing each element of self modified by a mapping function f.

pub fn select(mask: BVec2, if_true: Vec2, if_false: Vec2) -> Vec2

Creates a vector from the elements in if_true and if_false, selecting which to use for each element of self.

A true element in the mask uses the corresponding element from if_true, and false uses the element from if_false.

pub const fn from_array(a: [f32; 2]) -> Vec2

Creates a new vector from an array.

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

Converts self to [x, y]

pub const fn from_slice(slice: &[f32]) -> Vec2

Creates a vector from the first 2 values in slice.

§Panics

Panics if slice is less than 2 elements long.

pub fn write_to_slice(self, slice: &mut [f32])

Writes the elements of self to the first 2 elements in slice.

§Panics

Panics if slice is less than 2 elements long.

pub const fn extend(self, z: f32) -> Vec3

Creates a 3D vector from self and the given z value.

pub fn with_x(self, x: f32) -> Vec2

Creates a 2D vector from self with the given value of x.

pub fn with_y(self, y: f32) -> Vec2

Creates a 2D vector from self with the given value of y.

pub fn dot(self, rhs: Vec2) -> f32

Computes the dot product of self and rhs.

pub fn dot_into_vec(self, rhs: Vec2) -> Vec2

Returns a vector where every component is the dot product of self and rhs.

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

Returns a vector containing the minimum values for each element of self and rhs.

In other words this computes [min(x, rhs.x), min(self.y, rhs.y), ..].

NaN propogation does not follow IEEE 754-2008 semantics for minNum and may differ on different SIMD architectures.

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

Returns a vector containing the maximum values for each element of self and rhs.

In other words this computes [max(self.x, rhs.x), max(self.y, rhs.y), ..].

NaN propogation does not follow IEEE 754-2008 semantics for maxNum and may differ on different SIMD architectures.

pub fn clamp(self, min: Vec2, max: Vec2) -> Vec2

Component-wise clamping of values, similar to f32::clamp.

Each element in min must be less-or-equal to the corresponding element in max.

NaN propogation does not follow IEEE 754-2008 semantics and may differ on different SIMD architectures.

§Panics

Will panic if min is greater than max when glam_assert is enabled.

pub fn min_element(self) -> f32

Returns the horizontal minimum of self.

In other words this computes min(x, y, ..).

NaN propogation does not follow IEEE 754-2008 semantics and may differ on different SIMD architectures.

pub fn max_element(self) -> f32

Returns the horizontal maximum of self.

In other words this computes max(x, y, ..).

NaN propogation does not follow IEEE 754-2008 semantics and may differ on different SIMD architectures.

pub fn min_position(self) -> usize

Returns the index of the first minimum element of self.

pub fn max_position(self) -> usize

Returns the index of the first maximum element of self.

pub fn element_sum(self) -> f32

Returns the sum of all elements of self.

In other words, this computes self.x + self.y + ...

pub fn element_product(self) -> f32

Returns the product of all elements of self.

In other words, this computes self.x * self.y * ...

pub fn cmpeq(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a == comparison for each element of self and rhs.

In other words, this computes [self.x == rhs.x, self.y == rhs.y, ..] for all elements.

pub fn cmpne(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a != comparison for each element of self and rhs.

In other words this computes [self.x != rhs.x, self.y != rhs.y, ..] for all elements.

pub fn cmpge(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a >= comparison for each element of self and rhs.

In other words this computes [self.x >= rhs.x, self.y >= rhs.y, ..] for all elements.

pub fn cmpgt(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a > comparison for each element of self and rhs.

In other words this computes [self.x > rhs.x, self.y > rhs.y, ..] for all elements.

pub fn cmple(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a <= comparison for each element of self and rhs.

In other words this computes [self.x <= rhs.x, self.y <= rhs.y, ..] for all elements.

pub fn cmplt(self, rhs: Vec2) -> BVec2

Returns a vector mask containing the result of a < comparison for each element of self and rhs.

In other words this computes [self.x < rhs.x, self.y < rhs.y, ..] for all elements.

pub fn abs(self) -> Vec2

Returns a vector containing the absolute value of each element of self.

pub fn signum(self) -> Vec2

Returns a vector with elements representing the sign of self.

  • 1.0 if the number is positive, +0.0 or INFINITY
  • -1.0 if the number is negative, -0.0 or NEG_INFINITY
  • NAN if the number is NAN

pub fn copysign(self, rhs: Vec2) -> Vec2

Returns a vector with signs of rhs and the magnitudes of self.

pub fn is_negative_bitmask(self) -> u32

Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of self.

A negative element results in a 1 bit and a positive element in a 0 bit. Element x goes into the first lowest bit, element y into the second, etc.

An element is negative if it has a negative sign, including -0.0, NaNs with negative sign bit and negative infinity.

pub fn is_negative_mask(self) -> BVec2

Returns a mask indicating which components are negative.

An element is negative if it has a negative sign, including -0.0, NaNs with negative sign bit and negative infinity.

pub fn is_finite(self) -> bool

Returns true if, and only if, all elements are finite. If any element is either NaN, positive or negative infinity, this will return false.

pub fn is_finite_mask(self) -> BVec2

Performs is_finite on each element of self, returning a vector mask of the results.

In other words, this computes [x.is_finite(), y.is_finite(), ...].

pub fn is_nan(self) -> bool

Returns true if any elements are NaN.

pub fn is_nan_mask(self) -> BVec2

Performs is_nan on each element of self, returning a vector mask of the results.

In other words, this computes [x.is_nan(), y.is_nan(), ...].

pub fn length(self) -> f32

Computes the length of self.

pub fn length_squared(self) -> f32

Computes the squared length of self.

This is faster than length() as it avoids a square root operation.

pub fn length_recip(self) -> f32

Computes 1.0 / length().

For valid results, self must not be of length zero.

pub fn distance(self, rhs: Vec2) -> f32

Computes the Euclidean distance between two points in space.

pub fn distance_squared(self, rhs: Vec2) -> f32

Compute the squared euclidean distance between two points in space.

pub fn div_euclid(self, rhs: Vec2) -> Vec2

Returns the element-wise quotient of [Euclidean division] of self by rhs.

pub fn rem_euclid(self, rhs: Vec2) -> Vec2

Returns the element-wise remainder of Euclidean division of self by rhs.

pub fn normalize(self) -> Vec2

Returns self normalized to length 1.0.

For valid results, self must be finite and not of length zero, nor very close to zero.

See also Self::try_normalize() and Self::normalize_or_zero().

§Panics

Will panic if the resulting normalized vector is not finite when glam_assert is enabled.

pub fn try_normalize(self) -> Option<Vec2>

Returns self normalized to length 1.0 if possible, else returns None.

In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be None.

See also Self::normalize_or_zero().

pub fn normalize_or(self, fallback: Vec2) -> Vec2

Returns self normalized to length 1.0 if possible, else returns a fallback value.

In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value.

See also Self::try_normalize().

pub fn normalize_or_zero(self) -> Vec2

Returns self normalized to length 1.0 if possible, else returns zero.

In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero.

See also Self::try_normalize().

pub fn normalize_and_length(self) -> (Vec2, f32)

Returns self normalized to length 1.0 and the length of self.

If self is zero length then (Self::X, 0.0) is returned.

pub fn is_normalized(self) -> bool

Returns whether self is length 1.0 or not.

Uses a precision threshold of approximately 1e-4.

pub fn project_onto(self, rhs: Vec2) -> Vec2

Returns the vector projection of self onto rhs.

rhs must be of non-zero length.

§Panics

Will panic if rhs is zero length when glam_assert is enabled.

pub fn reject_from(self, rhs: Vec2) -> Vec2

Returns the vector rejection of self from rhs.

The vector rejection is the vector perpendicular to the projection of self onto rhs, in rhs words the result of self - self.project_onto(rhs).

rhs must be of non-zero length.

§Panics

Will panic if rhs has a length of zero when glam_assert is enabled.

pub fn project_onto_normalized(self, rhs: Vec2) -> Vec2

Returns the vector projection of self onto rhs.

rhs must be normalized.

§Panics

Will panic if rhs is not normalized when glam_assert is enabled.

pub fn reject_from_normalized(self, rhs: Vec2) -> Vec2

Returns the vector rejection of self from rhs.

The vector rejection is the vector perpendicular to the projection of self onto rhs, in rhs words the result of self - self.project_onto(rhs).

rhs must be normalized.

§Panics

Will panic if rhs is not normalized when glam_assert is enabled.

pub fn round(self) -> Vec2

Returns a vector containing the nearest integer to a number for each element of self. Round half-way cases away from 0.0.

pub fn floor(self) -> Vec2

Returns a vector containing the largest integer less than or equal to a number for each element of self.

pub fn ceil(self) -> Vec2

Returns a vector containing the smallest integer greater than or equal to a number for each element of self.

pub fn trunc(self) -> Vec2

Returns a vector containing the integer part each element of self. This means numbers are always truncated towards zero.

pub fn step(self, rhs: Vec2) -> Vec2

Returns a vector containing 0.0 if rhs < self and 1.0 otherwise.

Similar to glsl’s step(edge, x), which translates into edge.step(x)

pub fn smoothstep(self, edge0: Vec2, edge1: Vec2) -> Vec2

Performs Hermite interpolation between 0.0 and 1.0 using x normalized to [edge0, edge1].

This is equivalent to t * t * (3.0 - 2.0 * t), where t is clamped to [0.0, 1.0]. Results are undefined if any element of edge0 is greater than or equal to the corresponding element of edge1.

§Panics

Will panic if any element of edge0 is greater than or equal to the corresponding element of edge1, when glam_assert is enabled.

pub fn saturate(self) -> Vec2

Returns a vector containing all elements of self clamped to the range of [0, 1].

pub fn fract(self) -> Vec2

Returns a vector containing the fractional part of the vector as self - self.trunc().

Note that this differs from the GLSL implementation of fract which returns self - self.floor().

Note that this is fast but not precise for large numbers.

pub fn fract_gl(self) -> Vec2

Returns a vector containing the fractional part of the vector as self - self.floor().

Note that this differs from the Rust implementation of fract which returns self - self.trunc().

Note that this is fast but not precise for large numbers.

pub fn exp(self) -> Vec2

Returns a vector containing e^self (the exponential function) for each element of self.

pub fn exp2(self) -> Vec2

Returns a vector containing 2^self for each element of self.

pub fn ln(self) -> Vec2

Returns a vector containing the natural logarithm for each element of self. This returns NaN when the element is negative and negative infinity when the element is zero.

pub fn log2(self) -> Vec2

Returns a vector containing the base 2 logarithm for each element of self. This returns NaN when the element is negative and negative infinity when the element is zero.

pub fn powf(self, n: f32) -> Vec2

Returns a vector containing each element of self raised to the power of n.

pub fn sqrt(self) -> Vec2

Returns a vector containing the square root for each element of self. This returns NaN when the element is negative.

pub fn cos(self) -> Vec2

Returns a vector containing the cosine for each element of self.

pub fn sin(self) -> Vec2

Returns a vector containing the sine for each element of self.

pub fn sin_cos(self) -> (Vec2, Vec2)

Returns a tuple of two vectors containing the sine and cosine for each element of self.

pub fn recip(self) -> Vec2

Returns a vector containing the reciprocal 1.0/n of each element of self.

pub fn lerp(self, rhs: Vec2, s: f32) -> Vec2

Performs a linear interpolation between self and rhs based on the value s, using the form self * (1.0 - s) + rhs * s.

When s is 0.0, the result will be equal to self. When s is 1.0, the result will be equal to rhs. When s is outside of the range [0, 1], the result is linearly extrapolated.

The result is guaranteed to be self at s == 0.0 and rhs at s == 1.0, even when the values differ greatly in magnitude, but it is not monotonic in s for nearly equal inputs and may not preserve equal inputs exactly. Consider lerp_monotonic instead when interpolating between values that may be equal or nearly equal.

pub fn lerp_monotonic(self, rhs: Vec2, s: f32) -> Vec2

Performs a linear interpolation between self and rhs based on the value s, using the monotonic form self + (rhs - self) * s.

When s is 0.0, the result will be equal to self. When s is 1.0, the result will be equal to rhs. When s is outside of the range [0, 1], the result is linearly extrapolated.

Prefer this over lerp when interpolating between values that may be equal or nearly equal: the result is monotonic in s and equal inputs are preserved exactly, avoiding the rounding jitter that lerp can introduce. The tradeoff is that rhs - self is evaluated first, so this is less accurate than lerp when self and rhs differ greatly in magnitude, and overflows to infinity when they have opposite signs and large magnitudes.

On SIMD back-ends the multiply and add are fused when the target supports it, which has a single rounding step and can be more accurate than a separate multiply and add.

pub fn move_towards(self, rhs: Vec2, d: f32) -> Vec2

Moves towards rhs based on the value d.

When d is 0.0, the result will be equal to self. When d is equal to self.distance(rhs), the result will be equal to rhs. Will not go past rhs.

pub fn midpoint(self, rhs: Vec2) -> Vec2

Calculates the midpoint between self and rhs.

The midpoint is the average of, or halfway point between, two vectors. a.midpoint(b) should yield the same result as a.lerp(b, 0.5) while being slightly cheaper to compute.

pub fn abs_diff_eq(self, rhs: Vec2, max_abs_diff: f32) -> bool

Returns true if the absolute difference of all elements between self and rhs is less than or equal to max_abs_diff.

This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. The max_abs_diff that should be used used depends on the values being compared against.

For more see comparing floating point numbers.

pub fn clamp_length(self, min: f32, max: f32) -> Vec2

Returns a vector with a length no less than min and no more than max.

§Panics

Will panic if min is greater than max, or if either min or max is negative, when glam_assert is enabled.

pub fn clamp_length_max(self, max: f32) -> Vec2

Returns a vector with a length no more than max.

§Panics

Will panic if max is negative when glam_assert is enabled.

pub fn clamp_length_min(self, min: f32) -> Vec2

Returns a vector with a length no less than min.

§Panics

Will panic if min is negative when glam_assert is enabled.

pub fn mul_add(self, a: Vec2, b: Vec2) -> Vec2

Fused multiply-add. Computes (self * a) + b element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add.

Using mul_add may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.

pub fn reflect(self, normal: Vec2) -> Vec2

Returns the reflection vector for a given incident vector self and surface normal normal.

normal must be normalized.

§Panics

Will panic if normal is not normalized when glam_assert is enabled.

pub fn refract(self, normal: Vec2, eta: f32) -> Vec2

Returns the refraction direction for a given incident vector self, surface normal normal and ratio of indices of refraction, eta. When total internal reflection occurs, a zero vector will be returned.

self and normal must be normalized.

§Panics

Will panic if self or normal is not normalized when glam_assert is enabled.

pub fn from_angle(angle: f32) -> Vec2

Creates a 2D vector containing [angle.cos(), angle.sin()]. This can be used in conjunction with the rotate() method, e.g. Vec2::from_angle(PI).rotate(Vec2::Y) will create the vector [-1, 0] and rotate Vec2::Y around it returning -Vec2::Y.

pub fn to_angle(self) -> f32

Returns the angle (in radians) of this vector in the range [-π, +π].

The input does not need to be a unit vector however it must be non-zero.

pub fn angle_to(self, rhs: Vec2) -> f32

Returns the angle of rotation (in radians) from self to rhs in the range [-π, +π].

The inputs do not need to be unit vectors however they must be non-zero.

The returned angle can be used with rotate_angle(), e.g. self.rotate_angle(self.angle_to(rhs)) will be equal to rhs.

§Panics

Will panic if self or rhs has zero length when glam_assert is enabled.

pub fn perp(self) -> Vec2

Returns a vector that is equal to self rotated by 90 degrees.

pub fn perp_dot(self, rhs: Vec2) -> f32

The perpendicular dot product of self and rhs. Also known as the wedge product, 2D cross product, and determinant.

pub fn rotate(self, rhs: Vec2) -> Vec2

Returns rhs rotated by the angle of self. If self is normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication by self’s length.

This can be used in conjunction with the from_angle() method, e.g. Vec2::from_angle(PI).rotate(Vec2::Y) will create the vector [-1, 0] and rotate Vec2::Y around it returning -Vec2::Y.

pub fn rotate_angle(self, angle: f32) -> Vec2

Rotates self by angle (in radians), equivalent to self.rotate(Vec2::from_angle(angle)).

pub fn rotate_towards(self, rhs: Vec2, max_angle: f32) -> Vec2

Rotates towards rhs up to max_angle (in radians).

When max_angle is 0.0, the result will be equal to self. When max_angle is equal to self.angle_between(rhs), the result will be parallel to rhs. If max_angle is negative, rotates towards the exact opposite of rhs. Will not go past the target.

§Panics

Will panic if self or rhs are zero length when glam_assert is enabled.

pub fn as_dvec2(self) -> DVec2

Casts all elements of self to f64.

pub fn as_i8vec2(self) -> I8Vec2

Casts all elements of self to i8.

pub fn as_u8vec2(self) -> U8Vec2

Casts all elements of self to u8.

pub fn as_i16vec2(self) -> I16Vec2

Casts all elements of self to i16.

pub fn as_u16vec2(self) -> U16Vec2

Casts all elements of self to u16.

pub fn as_ivec2(self) -> IVec2

Casts all elements of self to i32.

pub fn as_uvec2(self) -> UVec2

Casts all elements of self to u32.

pub fn as_i64vec2(self) -> I64Vec2

Casts all elements of self to i64.

pub fn as_u64vec2(self) -> U64Vec2

Casts all elements of self to u64.

Trait Implementations§

§

impl AbsDiffEq for Vec2

§

type Epsilon = <f32 as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
§

fn default_epsilon() -> <Vec2 as AbsDiffEq>::Epsilon

The default tolerance to use when testing values that are close together. Read more
§

fn abs_diff_eq( &self, other: &Vec2, epsilon: <Vec2 as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
§

impl Add for Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: Vec2) -> Vec2

Performs the + operation. Read more
§

impl Add<&Vec2> for Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: &Vec2) -> Vec2

Performs the + operation. Read more
§

impl Add<&Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: &Vec2) -> Vec2

Performs the + operation. Read more
§

impl Add<&f32> for Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: &f32) -> Vec2

Performs the + operation. Read more
§

impl Add<&f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: &f32) -> Vec2

Performs the + operation. Read more
§

impl Add<Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: Vec2) -> Vec2

Performs the + operation. Read more
§

impl Add<f32> for Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: f32) -> Vec2

Performs the + operation. Read more
§

impl Add<f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the + operator.
§

fn add(self, rhs: f32) -> Vec2

Performs the + operation. Read more
§

impl AddAssign for Vec2

§

fn add_assign(&mut self, rhs: Vec2)

Performs the += operation. Read more
§

impl AddAssign<&Vec2> for Vec2

§

fn add_assign(&mut self, rhs: &Vec2)

Performs the += operation. Read more
§

impl AddAssign<&f32> for Vec2

§

fn add_assign(&mut self, rhs: &f32)

Performs the += operation. Read more
§

impl AddAssign<f32> for Vec2

§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
§

impl AsMut<[f32; 2]> for Vec2

§

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

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

impl AsMutVectorParts<f32, 2> for Vec2
where Vec2: AsMut<[f32; 2]>, f32: VectorScalar,

§

fn as_mut_parts(&mut self) -> &mut [f32; 2]

§

impl AsRef<[f32; 2]> for Vec2

§

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

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

impl AsRefVectorParts<f32, 2> for Vec2
where Vec2: AsRef<[f32; 2]>, f32: VectorScalar,

§

fn as_ref_parts(&self) -> &[f32; 2]

§

impl Clone for Vec2

§

fn clone(&self) -> Vec2

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for Vec2

§

impl CreateFrom for Vec2

§

fn create_from<B>(reader: &mut Reader<B>) -> Vec2
where B: BufferRef,

§

impl Debug for Vec2

§

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

Formats the value using the given formatter. Read more
§

impl Default for Vec2

§

fn default() -> Vec2

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for Vec2

Deserialize expects a sequence of 2 values.

§

fn deserialize<D>( deserializer: D, ) -> Result<Vec2, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Vec2

§

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

Formats the value using the given formatter. Read more
§

impl Div for Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: Vec2) -> Vec2

Performs the / operation. Read more
§

impl Div<&Vec2> for Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: &Vec2) -> Vec2

Performs the / operation. Read more
§

impl Div<&Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: &Vec2) -> Vec2

Performs the / operation. Read more
§

impl Div<&f32> for Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: &f32) -> Vec2

Performs the / operation. Read more
§

impl Div<&f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: &f32) -> Vec2

Performs the / operation. Read more
§

impl Div<Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: Vec2) -> Vec2

Performs the / operation. Read more
§

impl Div<f32> for Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: f32) -> Vec2

Performs the / operation. Read more
§

impl Div<f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the / operator.
§

fn div(self, rhs: f32) -> Vec2

Performs the / operation. Read more
§

impl DivAssign for Vec2

§

fn div_assign(&mut self, rhs: Vec2)

Performs the /= operation. Read more
§

impl DivAssign<&Vec2> for Vec2

§

fn div_assign(&mut self, rhs: &Vec2)

Performs the /= operation. Read more
§

impl DivAssign<&f32> for Vec2

§

fn div_assign(&mut self, rhs: &f32)

Performs the /= operation. Read more
§

impl DivAssign<f32> for Vec2

§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
§

impl From<(f32, f32)> for Vec2

§

fn from(t: (f32, f32)) -> Vec2

Converts to this type from the input type.
§

impl From<BVec2> for Vec2

§

fn from(v: BVec2) -> Vec2

Converts to this type from the input type.
Source§

impl<S> From<Matrix<f32, Const<2>, Const<1>, S>> for Vec2
where S: RawStorage<f32, Const<2>>,

Source§

fn from(e: Matrix<f32, Const<2>, Const<1>, S>) -> Vec2

Converts to this type from the input type.
Source§

impl From<OPoint<f32, Const<2>>> for Vec2

Source§

fn from(e: OPoint<f32, Const<2>>) -> Vec2

Converts to this type from the input type.
Source§

impl From<Translation<f32, 2>> for Vec2

Source§

fn from(e: Translation<f32, 2>) -> Vec2

Converts to this type from the input type.
Source§

impl From<Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>> for Vec2

Source§

fn from( e: Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>, ) -> Vec2

Converts to this type from the input type.
§

impl From<[f32; 2]> for Vec2

§

fn from(a: [f32; 2]) -> Vec2

Converts to this type from the input type.
§

impl FromVectorParts<f32, 2> for Vec2
where Vec2: From<[f32; 2]>, f32: VectorScalar,

§

fn from_parts(parts: [f32; 2]) -> Vec2

§

impl Index<usize> for Vec2

§

type Output = f32

The returned type after indexing.
§

fn index(&self, index: usize) -> &<Vec2 as Index<usize>>::Output

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

impl IndexMut<usize> for Vec2

§

fn index_mut(&mut self, index: usize) -> &mut <Vec2 as Index<usize>>::Output

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

impl Mul for Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec2) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<&Vec2> for Pose2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vec2) -> <Pose2 as Mul<&Vec2>>::Output

Performs the * operation. Read more
§

impl Mul<&Vec2> for Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
§

impl Mul<&Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
§

impl Mul<&Vec2> for Mat2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
§

impl Mul<&Vec2> for &Mat2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
§

impl Mul<&f32> for Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &f32) -> Vec2

Performs the * operation. Read more
§

impl Mul<&f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: &f32) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<Vec2> for Pose2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2) -> <Pose2 as Mul<Vec2>>::Output

Performs the * operation. Read more
Source§

impl Mul<Vec2> for &Pose2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2) -> <&Pose2 as Mul<Vec2>>::Output

Performs the * operation. Read more
Source§

impl Mul<Vec2> for Rot2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2) -> <Rot2 as Mul<Vec2>>::Output

Performs the * operation. Read more
§

impl Mul<Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec2) -> Vec2

Performs the * operation. Read more
§

impl Mul<Vec2> for Mat2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec2) -> <Mat2 as Mul<Vec2>>::Output

Performs the * operation. Read more
§

impl Mul<Vec2> for &Mat2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec2) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<Vec2> for SdpMatrix2<f32>

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
§

impl Mul<f32> for Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: f32) -> Vec2

Performs the * operation. Read more
§

impl Mul<f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the * operator.
§

fn mul(self, rhs: f32) -> Vec2

Performs the * operation. Read more
§

impl MulAssign for Vec2

§

fn mul_assign(&mut self, rhs: Vec2)

Performs the *= operation. Read more
§

impl MulAssign<&Vec2> for Vec2

§

fn mul_assign(&mut self, rhs: &Vec2)

Performs the *= operation. Read more
§

impl MulAssign<&f32> for Vec2

§

fn mul_assign(&mut self, rhs: &f32)

Performs the *= operation. Read more
§

impl MulAssign<f32> for Vec2

§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
§

impl Neg for Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn neg(self) -> Vec2

Performs the unary - operation. Read more
§

impl Neg for &Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn neg(self) -> Vec2

Performs the unary - operation. Read more
§

impl PartialEq for Vec2

§

fn eq(&self, other: &Vec2) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl Pod for Vec2

§

impl Product for Vec2

§

fn product<I>(iter: I) -> Vec2
where I: Iterator<Item = Vec2>,

Takes an iterator and generates Self from the elements by multiplying the items.
§

impl<'a> Product<&'a Vec2> for Vec2

§

fn product<I>(iter: I) -> Vec2
where I: Iterator<Item = &'a Vec2>,

Takes an iterator and generates Self from the elements by multiplying the items.
§

impl ReadFrom for Vec2

§

fn read_from<B>(&mut self, reader: &mut Reader<B>)
where B: BufferRef,

§

impl RelativeEq for Vec2

§

fn default_max_relative() -> <Vec2 as AbsDiffEq>::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
§

fn relative_eq( &self, other: &Vec2, epsilon: <Vec2 as AbsDiffEq>::Epsilon, max_relative: <Vec2 as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
§

impl Rem for Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: Vec2) -> Vec2

Performs the % operation. Read more
§

impl Rem<&Vec2> for Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: &Vec2) -> Vec2

Performs the % operation. Read more
§

impl Rem<&Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: &Vec2) -> Vec2

Performs the % operation. Read more
§

impl Rem<&f32> for Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: &f32) -> Vec2

Performs the % operation. Read more
§

impl Rem<&f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: &f32) -> Vec2

Performs the % operation. Read more
§

impl Rem<Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: Vec2) -> Vec2

Performs the % operation. Read more
§

impl Rem<f32> for Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: f32) -> Vec2

Performs the % operation. Read more
§

impl Rem<f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the % operator.
§

fn rem(self, rhs: f32) -> Vec2

Performs the % operation. Read more
§

impl RemAssign for Vec2

§

fn rem_assign(&mut self, rhs: Vec2)

Performs the %= operation. Read more
§

impl RemAssign<&Vec2> for Vec2

§

fn rem_assign(&mut self, rhs: &Vec2)

Performs the %= operation. Read more
§

impl RemAssign<&f32> for Vec2

§

fn rem_assign(&mut self, rhs: &f32)

Performs the %= operation. Read more
§

impl RemAssign<f32> for Vec2

§

fn rem_assign(&mut self, rhs: f32)

Performs the %= operation. Read more
§

impl SampleUniform for Vec2

§

type Sampler = UniformVec2<UniformFloat<f32>>

The UniformSampler implementation supporting type X.
§

impl Serialize for Vec2

Serialize as a sequence of 2 values.

§

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 ShaderSize for Vec2
where f32: ShaderSize,

Source§

const SHADER_SIZE: NonZero<u64> = _

Represents WGSL Size (equivalent to ShaderType::min_size)
§

impl ShaderType for Vec2
where f32: ShaderSize,

Source§

fn min_size() -> NonZero<u64>

Represents the minimum size of Self (equivalent to GPUBufferBindingLayout.minBindingSize) Read more
Source§

fn size(&self) -> NonZero<u64>

Returns the size of Self at runtime Read more
Source§

fn assert_uniform_compat()

§

impl StructuralPartialEq for Vec2

§

impl Sub for Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: Vec2) -> Vec2

Performs the - operation. Read more
§

impl Sub<&Vec2> for Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: &Vec2) -> Vec2

Performs the - operation. Read more
§

impl Sub<&Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: &Vec2) -> Vec2

Performs the - operation. Read more
§

impl Sub<&f32> for Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: &f32) -> Vec2

Performs the - operation. Read more
§

impl Sub<&f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: &f32) -> Vec2

Performs the - operation. Read more
§

impl Sub<Vec2> for &Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: Vec2) -> Vec2

Performs the - operation. Read more
§

impl Sub<f32> for Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: f32) -> Vec2

Performs the - operation. Read more
§

impl Sub<f32> for &Vec2

§

type Output = Vec2

The resulting type after applying the - operator.
§

fn sub(self, rhs: f32) -> Vec2

Performs the - operation. Read more
§

impl SubAssign for Vec2

§

fn sub_assign(&mut self, rhs: Vec2)

Performs the -= operation. Read more
§

impl SubAssign<&Vec2> for Vec2

§

fn sub_assign(&mut self, rhs: &Vec2)

Performs the -= operation. Read more
§

impl SubAssign<&f32> for Vec2

§

fn sub_assign(&mut self, rhs: &f32)

Performs the -= operation. Read more
§

impl SubAssign<f32> for Vec2

§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
§

impl Sum for Vec2

§

fn sum<I>(iter: I) -> Vec2
where I: Iterator<Item = Vec2>,

Takes an iterator and generates Self from the elements by “summing up” the items.
§

impl<'a> Sum<&'a Vec2> for Vec2

§

fn sum<I>(iter: I) -> Vec2
where I: Iterator<Item = &'a Vec2>,

Takes an iterator and generates Self from the elements by “summing up” the items.
§

impl UlpsEq for Vec2

§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
§

fn ulps_eq( &self, other: &Vec2, epsilon: <Vec2 as AbsDiffEq>::Epsilon, max_ulps: u32, ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
§

impl Vec2Swizzles for Vec2

§

type Vec3 = Vec3

§

type Vec4 = Vec4

§

fn xx(self) -> Vec2

§

fn yx(self) -> Vec2

§

fn yy(self) -> Vec2

§

fn xxx(self) -> Vec3

§

fn xxy(self) -> Vec3

§

fn xyx(self) -> Vec3

§

fn xyy(self) -> Vec3

§

fn yxx(self) -> Vec3

§

fn yxy(self) -> Vec3

§

fn yyx(self) -> Vec3

§

fn yyy(self) -> Vec3

§

fn xxxx(self) -> Vec4

§

fn xxxy(self) -> Vec4

§

fn xxyx(self) -> Vec4

§

fn xxyy(self) -> Vec4

§

fn xyxx(self) -> Vec4

§

fn xyxy(self) -> Vec4

§

fn xyyx(self) -> Vec4

§

fn xyyy(self) -> Vec4

§

fn yxxx(self) -> Vec4

§

fn yxxy(self) -> Vec4

§

fn yxyx(self) -> Vec4

§

fn yxyy(self) -> Vec4

§

fn yyxx(self) -> Vec4

§

fn yyxy(self) -> Vec4

§

fn yyyx(self) -> Vec4

§

fn yyyy(self) -> Vec4

§

fn xy(self) -> Self

§

impl WriteInto for Vec2

§

fn write_into<B>(&self, writer: &mut Writer<B>)
where B: BufferMut,

§

impl Zeroable for Vec2

Source§

fn zeroed() -> Self

Auto Trait Implementations§

§

impl Freeze for Vec2

§

impl RefUnwindSafe for Vec2

§

impl Send for Vec2

§

impl Sync for Vec2

§

impl Unpin for Vec2

§

impl UnsafeUnpin for Vec2

§

impl UnwindSafe for Vec2

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedDivAssign<Right> for T
where T: ClosedDiv<Right> + DivAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

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

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Borrowed> SampleBorrow<Borrowed> for Borrowed
where Borrowed: SampleUniform,

Source§

fn borrow(&self) -> &Borrowed

Immutably borrows from an owned value. See Borrow::borrow
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.