[][src]Struct wmi::safearray::SafeArrayAccessor

pub struct SafeArrayAccessor<T> { /* fields omitted */ }

Methods

impl<T> SafeArrayAccessor<T>[src]

An accessor to SafeArray, which:

  1. Locks the array so the data can be read.
  2. Unlocks the array once dropped.

Pointers to a Safe Array can come from different places (like GetNames, WMI property value), which can have different drop behavior (GetNames require the caller to deallocate the array, while a WMI property must be deallocated via VariantClear).

For this reason, we don't have a struct SafeArray.

However, accessing the data of the array must be done using a lock, which is the responsibility of this struct.

pub unsafe fn new(arr: *mut SAFEARRAY) -> Result<Self, Error>[src]

Creates a new Accessor, locking the given array,

Safety

This function is unsafe as it is the caller's responsibility to verify that the array is of items of type T.

pub fn as_slice(&self) -> &[T][src]

Return a slice which can access the data of the array.

Trait Implementations

impl<T> Drop for SafeArrayAccessor<T>[src]

impl<T: Debug> Debug for SafeArrayAccessor<T>[src]

Auto Trait Implementations

impl<T> !Send for SafeArrayAccessor<T>

impl<T> !Sync for SafeArrayAccessor<T>

impl<T> Unpin for SafeArrayAccessor<T>

impl<T> UnwindSafe for SafeArrayAccessor<T> where
    T: RefUnwindSafe

impl<T> RefUnwindSafe for SafeArrayAccessor<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]