rstmt_core/octave/
impl_octave_repr.rs

1/*
2    appellation: impl_octave_repr <module>
3    authors: @FL03
4*/
5use crate::octave::Octave;
6
7impl<T> Octave<&T> {
8    /// returns a new instance of the [`Octave`] with a cloned instance of the current value.alloc
9    pub fn cloned(&self) -> Octave<T>
10    where
11        T: Clone,
12    {
13        Octave(self.0.clone())
14    }
15    /// returns a new instance of the [`Octave`] with a copied instance of the current value
16    pub const fn copied(&self) -> Octave<T>
17    where
18        T: Copy,
19    {
20        Octave(*self.0)
21    }
22}
23
24impl<T> Octave<&mut T> {
25    /// returns a new instance of the [`Octave`] with a cloned instance of the current value.alloc
26    pub fn cloned(&self) -> Octave<T>
27    where
28        T: Clone,
29    {
30        Octave(self.0.clone())
31    }
32    /// returns a new instance of the [`Octave`] with a copied instance of the current value
33    pub const fn copied(&self) -> Octave<T>
34    where
35        T: Copy,
36    {
37        Octave(*self.0)
38    }
39}
40
41impl<T> Octave<*const T> {
42    /// returns a new instance of the [`Octave`] with a copied instance of the current value
43    pub const fn copied(&self) -> Octave<T>
44    where
45        T: Copy,
46    {
47        unsafe { Octave(*self.0) }
48    }
49}