Function sparse_mmap::try_copy
source · pub unsafe fn try_copy<T>(
src: *const T,
dest: *mut T,
count: usize,
) -> Result<(), MemoryError>
Expand description
Copies count
elements from src
to dest
. src
and dest
may overlap.
Fails on access violation/SIGSEGV. Note that on case of failure, some of the
bytes (even partial elements) may already have been copied.
This also fails if initialize_try_copy has not been called.
§Safety
This routine is safe to use if the memory pointed to by src
or dest
is
being concurrently mutated.
WARNING: This routine should only be used when you know that src
and
dest
are 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.