Struct StaticComObject
pub struct StaticComObject<T>where
T: ComObjectInner,{ /* private fields */ }Expand description
Stores a COM object in static memory.
Its reference count starts at one and tracks owned interface references. Access the object
through Self::get, which requires static storage so interfaces cannot outlive the object.
ⓘ
use windows_core::*;
interface_decl! {
unsafe trait IFoo(IFoo_Vtbl, IFoo_Impl): IUnknown
= 0x094d70d6_5202_44b8_abb8_43860da5aca2 {}
}
struct Foo;
implement_decl! { impl Foo as Foo_Impl: [IFoo] }
impl IFoo_Impl for Foo_Impl {}
let local = Foo.into_static();
let interface: IFoo = local.to_interface();
drop(local);ⓘ
use windows_core::*;
interface_decl! {
unsafe trait IFoo(IFoo_Vtbl, IFoo_Impl): IUnknown
= 0x094d70d6_5202_44b8_abb8_43860da5aca2 {}
}
struct Foo;
implement_decl! { impl Foo as Foo_Impl: [IFoo] }
impl IFoo_Impl for Foo_Impl {}
let local = Foo.into_static();
let interface: IFoo = local.get().to_interface();
drop(local);Implementations§
§impl<T> StaticComObject<T>where
T: ComObjectInner,
impl<T> StaticComObject<T>where
T: ComObjectInner,
pub const fn from_outer(outer: T::Outer) -> Self
pub const fn from_outer(outer: T::Outer) -> Self
Wraps outer in a StaticComObject.
§impl<T> StaticComObject<T>where
T: ComObjectInner,
impl<T> StaticComObject<T>where
T: ComObjectInner,
Auto Trait Implementations§
impl<T> Forget for StaticComObject<T>
impl<T> Freeze for StaticComObject<T>
impl<T> Move for StaticComObject<T>
impl<T> RefUnwindSafe for StaticComObject<T>
impl<T> Send for StaticComObject<T>
impl<T> Sync for StaticComObject<T>
impl<T> Unpin for StaticComObject<T>
impl<T> UnsafeUnpin for StaticComObject<T>
impl<T> UnwindSafe for StaticComObject<T>
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