Function sparse_mmap::try_write_volatile
source · pub unsafe fn try_write_volatile<T: AsBytes>(
dest: *mut T,
value: &T,
) -> Result<(), MemoryError>
Expand description
Writes value
at dest
treating the pointer as a volatile access.
Returns Ok(())
if the write was successful, or Err(MemoryError)
if the
write was unsuccessful.
Panics if the size is not 1, 2, 4, or 8 bytes.
§Safety
This routine is safe to use if the memory pointed to by dest
is being
concurrently mutated.
WARNING: This routine should only be used when you know that dest
is
valid, reserved addresses but you do not know if they are mapped with the
appropriate protection. For example, this routine is useful if dest
is a
sparse mapping where some pages are mapped with PAGE_NOACCESS/PROT_NONE, and
some are mapped with PAGE_READWRITE/PROT_WRITE.