pub unsafe fn context_is_valid(context: *mut Context) -> bool
Expand description

Makes a best effort attempt to check if the given pointer actually points at a valid instance of Context struct.

Safety

If the pointer doesn’t actually point at a Context struct this function may crash or invoke undefined behaviour.

Unfortunately modern operating systems don’t give us a good way to check if a memory address is writable (other than some hacks with the read system call, see https://stackoverflow.com/a/14437277/3093427). So currently this is the best thing we can do.