autocommit 2022-02-20 15:31:54 CET
This commit is contained in:
parent
0f2fbcc5e7
commit
26fab1e3e2
10 changed files with 198 additions and 19 deletions
|
|
@ -9,6 +9,14 @@ pub struct CloneCell<T: UnsafeCellCloneSafe> {
|
|||
data: UnsafeCell<T>,
|
||||
}
|
||||
|
||||
impl<T: UnsafeCellCloneSafe> Clone for CloneCell<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
data: UnsafeCell::new(self.get()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: UnsafeCellCloneSafe + Debug> Debug for CloneCell<T> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
unsafe { self.data.get().deref().fmt(f) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue