Struct StaticComObject
pub struct StaticComObject<T>where
T: ComObjectInner,{ /* private fields */ }
Expand description
Enables applications to define COM objects using static storage. This is useful for factory objects, stateless objects, or objects which use need to contain or use mutable global state.
COM objects that are defined using StaticComObject
have their storage placed directly in
static storage; they are not stored in the heap.
COM objects defined using StaticComObject
do have a reference count and this reference
count is adjusted when owned COM interface references (e.g. IFoo
and IUnknown
) are created
for the object. The reference count is initialized to 1.
§Example
ⓘ
#[implement(IFoo)]
struct MyApp {
// ...
}
static MY_STATIC_APP: StaticComObject<MyApp> = MyApp { ... }.into_static();
fn get_my_static_ifoo() -> IFoo {
MY_STATIC_APP.to_interface()
}
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,
Trait Implementations§
§impl<T> Deref for StaticComObject<T>where
T: ComObjectInner,
impl<T> Deref for StaticComObject<T>where
T: ComObjectInner,
Auto Trait Implementations§
impl<T> Freeze 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> 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