pub struct SafeOwnedMemZero(/* private fields */);
Expand description
Handle for zeroing owned memory. “Owned” in this context refers to memory
that has been allocated and stored in some kind of char **
argument
in the context of C FFI. This means that the memory has been allocated
by standard C allocators and needs to be cleaned up by the caller.
In the context of Rust, we would consider this owned by the current scope.
§SECURITY WARNING
Any pointer used with this must point to memory allocated by libc::malloc
or any other function compatible with libc::free
. If it has not been,
you could cause memory corruption and security problems.
Implementations§
Source§impl SafeOwnedMemZero
impl SafeOwnedMemZero
Sourcepub unsafe fn from_ptr(ptr: *mut c_void, size: usize) -> Self
pub unsafe fn from_ptr(ptr: *mut c_void, size: usize) -> Self
Construct a safe memory handle from a pointer and a size.
§Safety
The pointer must point to memory allocated by libc::malloc
or something
compatible with libc::free
. See the struct-level security warning for more
information. The size
argument also must match the length of the
allocated block or memory corruption could occur.
Trait Implementations§
Source§impl AsMut<[u8]> for SafeOwnedMemZero
impl AsMut<[u8]> for SafeOwnedMemZero
Source§impl AsRef<[u8]> for SafeOwnedMemZero
impl AsRef<[u8]> for SafeOwnedMemZero
Source§impl Drop for SafeOwnedMemZero
impl Drop for SafeOwnedMemZero
Source§impl SafeMemzero for SafeOwnedMemZero
impl SafeMemzero for SafeOwnedMemZero
Source§fn safe_memzero(&mut self)
fn safe_memzero(&mut self)
Drop
implementation.Auto Trait Implementations§
impl Freeze for SafeOwnedMemZero
impl RefUnwindSafe for SafeOwnedMemZero
impl !Send for SafeOwnedMemZero
impl !Sync for SafeOwnedMemZero
impl Unpin for SafeOwnedMemZero
impl UnwindSafe for SafeOwnedMemZero
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more