rsfi_core/
point.rs

1/*
2    Appellation: point <module>
3    Created At: 2025.12.29:14:01:09
4    Contrib: @FL03
5*/
6mod impl_point;
7mod impl_point_ext;
8mod impl_point_repr;
9/// An instance of the [`Point`] implementation containing owned references to the inner values.
10pub type PointView<'a, X, Y = X> = Point<&'a X, &'a Y>;
11/// An instance of the [`Point`] implementation containing mutable references to the inner
12/// values.
13pub type PointViewMut<'a, X, Y = X> = Point<&'a mut X, &'a mut Y>;
14/// A [`Point`] whose elements are raw pointers to `X` and `Y`
15pub type RawPoint<X, Y = X> = Point<*const X, *const Y>;
16/// A mutable [`Point`] whose elements are raw pointers to `X` and `Y`
17pub type RawPointMut<X, Y = X> = Point<*mut X, *mut Y>;
18
19/// The [`Point`] implementation is designed a generic, 2-dimensional point object used to
20/// define coordinates, vectors, or positions in a 2D space.
21#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
22#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
23#[repr(C)]
24pub struct Point<X, Y = X> {
25    #[cfg_attr(feature = "serde", serde(alias = "lhs", alias = "a"))]
26    pub x: X,
27    #[cfg_attr(feature = "serde", serde(alias = "rhs", alias = "b"))]
28    pub y: Y,
29}