Sync computers
This commit is contained in:
12
src/volatile.rs
Normal file
12
src/volatile.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Volatile<T>(T);
|
||||
|
||||
impl<T> Volatile<T> {
|
||||
pub unsafe fn read(self: *const Self) -> T {
|
||||
unsafe { core::ptr::read_volatile(self as *const T) }
|
||||
}
|
||||
pub unsafe fn write(self: *mut Self, value: T) {
|
||||
unsafe { core::ptr::write_volatile(self as *mut T, value) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user