13 lines
365 B
Rust
13 lines
365 B
Rust
#[repr(transparent)]
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct Volatile<T>(T);
|
|
|
|
impl<T> Volatile<T> {
|
|
pub unsafe fn read_volatile(self: *const Self) -> T {
|
|
unsafe { core::ptr::read_volatile(self as *const T) }
|
|
}
|
|
pub unsafe fn write_volatile(self: *mut Self, value: T) {
|
|
unsafe { core::ptr::write_volatile(self as *mut T, value) }
|
|
}
|
|
}
|