summaryrefslogtreecommitdiff
path: root/vendor/windows-core/src/as_impl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/windows-core/src/as_impl.rs')
-rw-r--r--vendor/windows-core/src/as_impl.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/windows-core/src/as_impl.rs b/vendor/windows-core/src/as_impl.rs
new file mode 100644
index 00000000..75a8b60b
--- /dev/null
+++ b/vendor/windows-core/src/as_impl.rs
@@ -0,0 +1,20 @@
+/// A trait for retrieving the implementation behind a COM or WinRT interface.
+///
+/// This trait is automatically implemented when using the `implement` macro.
+pub trait AsImpl<T> {
+ /// # Safety
+ ///
+ /// The caller needs to ensure that `self` is actually implemented by the
+ /// implementation `T`.
+ unsafe fn as_impl(&self) -> &T {
+ unsafe { self.as_impl_ptr().as_ref() }
+ }
+
+ /// Returns a pointer to the implementation object.
+ ///
+ /// # Safety
+ ///
+ /// The caller needs to ensure that `self` is actually implemented by the
+ /// implementation `T`.
+ unsafe fn as_impl_ptr(&self) -> core::ptr::NonNull<T>;
+}