virtio-gpu: start working on the scheme
Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use core::cell::UnsafeCell;
|
||||
use core::fmt::Debug;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
pub struct VolatileCell<T> {
|
||||
value: UnsafeCell<T>,
|
||||
@@ -28,6 +28,17 @@ impl<T: Copy> VolatileCell<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Debug for VolatileCell<T>
|
||||
where
|
||||
T: Debug + Copy,
|
||||
{
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("VolatileCell")
|
||||
.field("value", &self.get())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T> Sync for VolatileCell<T> {}
|
||||
|
||||
#[repr(C)]
|
||||
|
||||
Reference in New Issue
Block a user