Function region::protect_with_handle[][src]

pub unsafe fn protect_with_handle(
    address: *const u8,
    size: usize,
    protection: Protection
) -> Result<ProtectGuard>

Changes the memory protection of one or more pages temporarily.

The address range may overlap one or more pages, and if so, all pages within the range will be modified. The protection flags will be reset when the handle is dropped.

This function uses query_range internally and is therefore less performant than protect. Prefer this function only if a memory protection reset is desired.

Safety

This is unsafe since it can change read-only properties of constants and/or modify the executable properties of any code segments.