pub trait Wrapper<C: Class + ?Sized> {
    // Required methods
    unsafe fn data_from_header(ptr: *mut Header<C>) -> *mut C;
    unsafe fn header_from_data(ptr: *mut C) -> *mut Header<C>;
    unsafe fn add_ref(ptr: *mut C) -> usize;
    unsafe fn release(ptr: *mut C) -> usize;
}
Expand description

Helper functionality used in generated virtual tables for Rust types.

The purpose of this trait is to allow the Construct implementations generated by com-scrape to avoid hard-coding any particular reference counting logic or class layout, and to instead allow this logic to be plugged in at the point where the COM object is constructed.

Currently, the only type implementing this trait is ComWrapper, but it would be possible for additional wrapper types to implement it in the future.

Required Methods§

source

unsafe fn data_from_header(ptr: *mut Header<C>) -> *mut C

Given a pointer to an object’s header, returns a pointer to the object itself.

source

unsafe fn header_from_data(ptr: *mut C) -> *mut Header<C>

Given a pointer to an object, returns a pointer to the object’s header.

source

unsafe fn add_ref(ptr: *mut C) -> usize

Increments the reference count of an object and returns the resulting count.

source

unsafe fn release(ptr: *mut C) -> usize

Decrements the reference count of an object and returns the resulting count.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C: Class> Wrapper<C> for ComWrapper<C>