rspace_core/point/
impl_point_repr.rs

1/*
2    Appellation: impl_point_repr <module>
3    Created At: 2025.12.29:14:05:09
4    Contrib: @FL03
5*/
6use super::Point;
7
8impl<'a, X, Y> Point<&'a X, &'a Y> {
9    /// returns an new instance of the [`Point`] with cloned values
10    pub fn cloned(&self) -> Point<X, Y>
11    where
12        X: Clone,
13        Y: Clone,
14    {
15        Point {
16            x: self.x.clone(),
17            y: self.y.clone(),
18        }
19    }
20    /// return a new instance of the [`Point`] with copied values
21    pub const fn copied(&self) -> Point<X, Y>
22    where
23        X: Copy,
24        Y: Copy,
25    {
26        Point {
27            x: *self.x,
28            y: *self.y,
29        }
30    }
31}
32
33impl<'a, X, Y> Point<&'a mut X, &'a mut Y> {
34    /// returns an new instance of the [`Point`] with cloned values
35    pub fn cloned(&self) -> Point<X, Y>
36    where
37        X: Clone,
38        Y: Clone,
39    {
40        Point {
41            x: self.x.clone(),
42            y: self.y.clone(),
43        }
44    }
45    /// return a new instance of the [`Point`] with copied values
46    pub const fn copied(&self) -> Point<X, Y>
47    where
48        X: Copy,
49        Y: Copy,
50    {
51        Point {
52            x: *self.x,
53            y: *self.y,
54        }
55    }
56}