rstmt_core/pitch/impls/
impl_pitch_repr.rs

1/*
2    Appellation: impl_pitch_repr <module>
3    Created At: 2025.12.20:09:08:56
4    Contrib: @FL03
5*/
6use crate::pitch::{Pitch, RawPitch};
7
8impl<T> Pitch<&T>
9where
10    T: RawPitch,
11{
12    /// returns a new instance of the [`Pitch`] containing a cloned inner value
13    pub fn cloned(&self) -> Pitch<T>
14    where
15        T: Clone,
16    {
17        Pitch::new(self.0.clone())
18    }
19    /// returns a new instance of the [`Pitch`] containing a copied inner value
20    pub const fn copied(&self) -> Pitch<T>
21    where
22        T: Copy,
23    {
24        Pitch::new(*self.0)
25    }
26}
27
28impl<T> Pitch<&mut T>
29where
30    T: RawPitch,
31{
32    /// returns a new instance of the [`Pitch`] containing a cloned inner value
33    pub fn cloned(&self) -> Pitch<T>
34    where
35        T: Clone,
36    {
37        Pitch::new(self.0.clone())
38    }
39    /// returns a new instance of the [`Pitch`] containing a copied inner value
40    pub const fn copied(&self) -> Pitch<T>
41    where
42        T: Copy,
43    {
44        Pitch::new(*self.0)
45    }
46}