diff --git a/crates/libs/windows/src/core/agile_reference.rs b/crates/libs/windows/src/core/agile_reference.rs index f7ee4171eb..1eba0baa24 100644 --- a/crates/libs/windows/src/core/agile_reference.rs +++ b/crates/libs/windows/src/core/agile_reference.rs @@ -2,12 +2,17 @@ use super::*; use bindings::*; use core::marker::PhantomData; +/// A safe wrapper around WinRT interfaces. +/// +/// Some interfaces are not marked as agile thus then don't implement [`Send`]. +/// These interfaces can be made agile through this `AgileReference`. pub struct AgileReference { reference: IAgileReference, _marker: PhantomData, } impl AgileReference { + /// Creates a new wrapper around the reference pub fn new<'a>(from_ref: &'a T) -> Result where &'a T: IntoParam<'a, IUnknown>, @@ -15,6 +20,7 @@ impl AgileReference { unsafe { RoGetAgileReference(AGILEREFERENCE_DEFAULT, &T::IID, from_ref).map(|reference| Self { reference, _marker: Default::default() }) } } + /// Resolves the reference for the current thread. pub fn resolve(&self) -> Result { unsafe { self.reference.Resolve() } }