refclone 0.1.0

Mark a type, whose clone operation does not changes it's deref value. Ex Rc,Arc
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::{rc::Rc, sync::Arc};

pub unsafe trait RefClone: Clone {
    fn ref_clone(&self) -> Self { self.clone() }
}

unsafe impl<T> RefClone for Rc<T> {
    fn ref_clone(&self) -> Self { self.clone() }
}
unsafe impl<T> RefClone for Arc<T> {
    fn ref_clone(&self) -> Self { self.clone() }
}