summaryrefslogtreecommitdiff
path: root/vendor/windows-core/src/as_impl.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
committermo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
commit8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch)
tree22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/windows-core/src/as_impl.rs
parent4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff)
chore: add vendor directory
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>;
+}