1
0
Fork 0
forked from wry/wry

autocommit 2022-02-11 02:28:11 CET

This commit is contained in:
Julian Orth 2022-02-11 02:28:11 +01:00
parent 83c3fb99f9
commit 9b8e1ac29f
63 changed files with 690 additions and 122 deletions

View file

@ -1,6 +1,7 @@
use crate::utils::linkedlist::NodeRef;
use crate::utils::ptr_ext::{MutPtrExt, PtrExt};
use std::cell::UnsafeCell;
use std::fmt::{Debug, Formatter};
use std::mem;
use std::rc::Rc;
@ -8,6 +9,12 @@ pub struct CloneCell<T: UnsafeCellCloneSafe> {
data: UnsafeCell<T>,
}
impl<T: UnsafeCellCloneSafe + Debug> Debug for CloneCell<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
unsafe { self.data.get().deref().fmt(f) }
}
}
impl<T: UnsafeCellCloneSafe> CloneCell<T> {
pub fn new(t: T) -> Self {
Self {