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,

source

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.

source

pub const fn as_ptr(&self) -> *const c_void

Returns a pointer to the allocated memory block, or null if not allocated.

source

pub fn as_mut_ptr(&mut self) -> *mut c_void

Returns a mutable pointer to the allocated memory block, or null if not allocated.

source

pub const fn as_slice(&self) -> &[u8]

Returns a slice over the allocated memory block.

source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice over the allocated memory block.

source

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.

source

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.

source

pub const fn len(&self) -> usize

Returns the size of the allocated memory block.

Trait Implementations§

source§

impl<'a, H> Drop for GlobalUnlockGuard<'a, H>
where H: kernel_Hglobal,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.