pub struct Delegate { /* private fields */ }Expand description
A delegate Windows can call: an event handler or an async completion.
#[repr(C)] with the vtable first, so a pointer to this is a valid COM
interface pointer. The refcount is atomic because the runtime may hold and
release it from several threads.
Implementations§
Source§impl Delegate
impl Delegate
Sourcepub fn new(
iid: Guid,
handler: impl Fn(*mut c_void, *mut c_void) + Send + Sync + 'static,
) -> ComPtr
pub fn new( iid: Guid, handler: impl Fn(*mut c_void, *mut c_void) + Send + Sync + 'static, ) -> ComPtr
Build one, returning a +1 COM pointer.
Not -> Self: the object owns itself and lives until the last
Release, so what the caller gets is a reference to it, not the value.
The object owns itself: it is freed when the last Release arrives,
which is why this hands back a pointer rather than a Rust value.
Auto Trait Implementations§
impl !Freeze for Delegate
impl !RefUnwindSafe for Delegate
impl !Send for Delegate
impl !Sync for Delegate
impl !UnwindSafe for Delegate
impl Unpin for Delegate
impl UnsafeUnpin for Delegate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more