PixelVector
struct · ferroui-base · v0.5.0
struct PixelVector
Defines a vector in device pixels. Integer arithmetic wraps on overflow.
Members
x
x: i32
The X component.
y
y: i32
The Y component.
new
const fn new(x: i32, y: i32) -> Self
Initializes a new instance of the PixelVector structure.
length
fn length(self: &Self) -> f64
Length of the vector. The squared length is computed in (wrapping) 32-bit integer arithmetic, so very large vectors yield NaN or a wrapped length.
equals
const fn equals(self: &Self, other: PixelVector) -> bool
Check if two vectors are equal (bitwise).
nearly_equals
fn nearly_equals(self: &Self, other: PixelVector) -> bool
Check if two vectors are nearly equal (numerically). For integer components this is the same as equality.
Panics
Panics if a component difference is i32::MIN, whose absolute value is not
representable.
with_x
const fn with_x(self: &Self, x: i32) -> PixelVector
Returns a new vector with the specified X component.
with_y
const fn with_y(self: &Self, y: i32) -> PixelVector
Returns a new vector with the specified Y component.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherMarkupTypedValueTypeRegistrationFrom<PixelPoint>Add<PixelVector>Sub<PixelVector>AddAssign<PixelVector>SubAssign<PixelVector>CloneCopyDebugStructuralPartialEqPartialEqEqHashDefaultFrom<PixelVector>MulMul<i32>Div<i32>NegAddSubAddAssignSubAssignMulAssign<i32>DivAssign<i32>Display
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.