Struct winsafe::guard::LocalUnlockGuard
source · pub struct LocalUnlockGuard<'a, H>where
H: kernel_Hlocal,{ /* private fields */ }
Available on crate feature
kernel
only.Expand description
RAII implementation for HLOCAL
lock which automatically
calls
LocalUnlock
when the object goes out of scope.
Implementations§
source§impl<'a, H> LocalUnlockGuard<'a, H>where
H: kernel_Hlocal,
impl<'a, H> LocalUnlockGuard<'a, H>where
H: kernel_Hlocal,
sourcepub const unsafe fn new(hlocal: &'a H, pmem: *mut c_void, sz: usize) -> Self
pub const unsafe fn new(hlocal: &'a H, pmem: *mut c_void, sz: usize) -> Self
Constructs the guard.
§Safety
Be sure the handle must be freed with
LocalUnlock
at the end of scope, the pointer is valid, and the size is correct.
sourcepub const fn as_ptr(&self) -> *const c_void
pub const fn as_ptr(&self) -> *const c_void
Returns a pointer to the allocated memory block, or null if not allocated.
sourcepub fn as_mut_ptr(&mut self) -> *mut c_void
pub fn as_mut_ptr(&mut self) -> *mut c_void
Returns a mutable pointer to the allocated memory block, or null if not allocated.
sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice over the allocated memory block.
sourcepub const unsafe fn as_slice_aligned<T>(&self) -> &[T]
pub const unsafe fn as_slice_aligned<T>(&self) -> &[T]
Returns a slice over the allocated memory block, aligned to the given type.
§Safety
Make sure the alignment is correct.
sourcepub unsafe fn as_mut_slice_aligned<T>(&mut self) -> &mut [T]
pub unsafe fn as_mut_slice_aligned<T>(&mut self) -> &mut [T]
Returns a mutable slice over the allocated memory block, aligned to the given type.
§Safety
Make sure the alignment is correct.
Trait Implementations§
source§impl<'a, H> Drop for LocalUnlockGuard<'a, H>where
H: kernel_Hlocal,
impl<'a, H> Drop for LocalUnlockGuard<'a, H>where
H: kernel_Hlocal,
Auto Trait Implementations§
impl<'a, H> Freeze for LocalUnlockGuard<'a, H>
impl<'a, H> RefUnwindSafe for LocalUnlockGuard<'a, H>where
H: RefUnwindSafe,
impl<'a, H> !Send for LocalUnlockGuard<'a, H>
impl<'a, H> !Sync for LocalUnlockGuard<'a, H>
impl<'a, H> Unpin for LocalUnlockGuard<'a, H>
impl<'a, H> UnwindSafe for LocalUnlockGuard<'a, H>where
H: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more