FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    PixelVector

    struct · ferroui-base · v0.5.0

    struct PixelVector
    

    Defines a vector in device pixels. Integer arithmetic wraps on overflow.

    View source

    Members

    x

    x: i32
    

    The X component.

    Source

    y

    y: i32
    

    The Y component.

    Source

    new

    const fn new(x: i32, y: i32) -> Self
    

    Initializes a new instance of the PixelVector structure.

    Source

    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.

    Source

    equals

    const fn equals(self: &Self, other: PixelVector) -> bool
    

    Check if two vectors are equal (bitwise).

    Source

    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.

    Source

    with_x

    const fn with_x(self: &Self, x: i32) -> PixelVector
    

    Returns a new vector with the specified X component.

    Source

    with_y

    const fn with_y(self: &Self, y: i32) -> PixelVector
    

    Returns a new vector with the specified Y component.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ResourceKeyObject
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • ErasedDestructor
    • IntoEither
    • MarkupTyped
    • ValueTypeRegistration
    • From<PixelPoint>
    • Add<PixelVector>
    • Sub<PixelVector>
    • AddAssign<PixelVector>
    • SubAssign<PixelVector>
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Eq
    • Hash
    • Default
    • From<PixelVector>
    • Mul
    • Mul<i32>
    • Div<i32>
    • Neg
    • Add
    • Sub
    • AddAssign
    • SubAssign
    • MulAssign<i32>
    • DivAssign<i32>
    • Display

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.