Debian Codegraph @

third_party/rust/windows-core/src/as_impl.rs

raw
1 /// A trait for retrieving the implementation behind a COM or WinRT interface.
2 ///
3 /// This trait is automatically implemented when using the `implement` macro.
4 pub trait AsImpl<T> {
5 /// # Safety
6 ///
7 /// The caller needs to ensure that `self` is actually implemented by the
8 /// implementation `T`.
9 unsafe fn as_impl(&self) -> &T {
10 self.as_impl_ptr().as_ref()
11 }
12
13 /// Returns a pointer to the implementation object.
14 ///
15 /// # Safety
16 ///
17 /// The caller needs to ensure that `self` is actually implemented by the
18 /// implementation `T`.
19 unsafe fn as_impl_ptr(&self) -> core::ptr::NonNull<T>;
20 }