Trait com_scrape_types::Wrapper
source · 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§
sourceunsafe fn data_from_header(ptr: *mut Header<C>) -> *mut C
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.
sourceunsafe fn header_from_data(ptr: *mut C) -> *mut Header<C>
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.
Object Safety§
This trait is not object safe.