Function relocate_member_if_newer

Source
pub unsafe fn relocate_member_if_newer<THIS, T>(
    version: Version,
    this: &THIS,
    older: isize,
    newer: isize,
) -> Result<&T, RelocationError>
Expand description

Relocates a member based on the version comparison, using either older or newer offset depending on the current version.

§Safety

It is safe as long as the following are observed.

  • ptr of offset added is valid
  • ptr of added offset never exceeds isize::MAX
  • All memory from this to offset is valid.

§Errors

  • This function may return an error if the module’s state cannot be accessed, or if the map_active call fails when fetching the current version.
  • If the pointer is null
  • If the pointer is unaligned