IAllocator

Trait IAllocator 

Source
pub trait IAllocator: IUnknown {
    // Required methods
    unsafe fn alloc_bstr(&self, text: *const u16, len: u32) -> BSTR;
    unsafe fn free_bstr(&self, bstr: BSTR);
    unsafe fn alloc(&self, len: usize) -> *mut c_void;
    unsafe fn free(&self, ptr: *mut c_void);
}

Required Methods§

Source

unsafe fn alloc_bstr(&self, text: *const u16, len: u32) -> BSTR

Allocates a new BSTR based on an existing string value.

§Arguments
  • psz - A pointer to an existing wide character (16-bit) string.
  • len - String length.
§Safety

The function is safe to call as long as the psz is valid in relation to the given len. The returned value must be freed using BSTR aware free function, such as the free_bstr in this interface or the SysFreeString function on Windows.

Source

unsafe fn free_bstr(&self, bstr: BSTR)

Frees a BSTR value.

§Arguments
  • bstr - Previously allocated BSTR value.
§Safety

The function is safe as long as the bstr is a valid BSTR value.

Source

unsafe fn alloc(&self, len: usize) -> *mut c_void

Allocates a segment of memory that is safe to pass through intercom interfaces.

§Arguments
  • len - Size of data to allocate.
§Safety

The returned value must be freed using the free method in this interface or the intercom alloc::free function.

Source

unsafe fn free(&self, ptr: *mut c_void)

Frees a segment of memory received through intercom interfaces.

§Arguments
  • ptr - Memory to free.
§Safety

The memory must have been allocated using the alloc method in this interface or the intercom alloc::allocate function.

Trait Implementations§

Source§

impl ComClassInterface<dyn IAllocator, AutomationTypeSystem> for Allocator

Source§

fn offset() -> usize

Source§

unsafe fn get_box<'a>(vtable: RawComPtr) -> &'a mut ComBoxData<Self>

Safety Read more
Source§

impl ComClassInterface<dyn IAllocator, RawTypeSystem> for Allocator

Source§

fn offset() -> usize

Source§

unsafe fn get_box<'a>(vtable: RawComPtr) -> &'a mut ComBoxData<Self>

Safety Read more
Source§

impl ComInterface for dyn IAllocator

Source§

fn iid_ts<TS: TypeSystem>() -> &'static IID
where Self: ComInterfaceVariant<TS>,

Returns the IID of the requested interface.

Source§

type TSelf = dyn IAllocator

The current interface. Read more
Source§

fn iid(ts: TypeSystemName) -> Option<&'static IID>

IID of the COM interface.
Source§

fn deref(com_itf: &ComItf<dyn IAllocator>) -> &(dyn IAllocator + 'static)

Dereferences a ComItf<T> into a &T. Read more
Source§

impl ComInterfaceTypeInfo for dyn IAllocator

Source§

impl<I, S> ComInterfaceVTableFor<I, S, AutomationTypeSystem> for dyn IAllocator

Source§

const VTABLE: __IAllocatorAutomationVTable

Source§

impl<I, S> ComInterfaceVTableFor<I, S, RawTypeSystem> for dyn IAllocator

Source§

const VTABLE: __IAllocatorRawVTable

Source§

impl ForeignType for dyn IAllocator

Source§

fn type_name() -> &'static str

The name of the type.

Source§

fn indirection_level() -> u32

Source§

impl HasInterface<dyn IAllocator> for Allocator

Implementors§