Struct winsafe::guard::GlobalUnlockGuard
source · pub struct GlobalUnlockGuard<'a, H>where
H: kernel_Hglobal,{ /* private fields */ }
Available on crate feature
kernel
only.Expand description
RAII implementation for HGLOBAL
lock which automatically
calls
GlobalUnlock
when the object goes out of scope.
Implementations§
source§impl<'a, H> GlobalUnlockGuard<'a, H>where
H: kernel_Hglobal,
impl<'a, H> GlobalUnlockGuard<'a, H>where
H: kernel_Hglobal,
sourcepub const unsafe fn new(hglobal: &'a H, pmem: *mut c_void, sz: usize) -> Self
pub const unsafe fn new(hglobal: &'a H, pmem: *mut c_void, sz: usize) -> Self
Constructs the guard.
§Safety
Be sure the handle must be freed with
GlobalUnlock
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 GlobalUnlockGuard<'a, H>where
H: kernel_Hglobal,
impl<'a, H> Drop for GlobalUnlockGuard<'a, H>where
H: kernel_Hglobal,
Auto Trait Implementations§
impl<'a, H> Freeze for GlobalUnlockGuard<'a, H>
impl<'a, H> RefUnwindSafe for GlobalUnlockGuard<'a, H>where
H: RefUnwindSafe,
impl<'a, H> !Send for GlobalUnlockGuard<'a, H>
impl<'a, H> !Sync for GlobalUnlockGuard<'a, H>
impl<'a, H> Unpin for GlobalUnlockGuard<'a, H>
impl<'a, H> UnwindSafe for GlobalUnlockGuard<'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