diff --git a/crates/libs/implement/Cargo.toml b/crates/libs/implement/Cargo.toml index a7282fa4bc..e27bd53e4c 100644 --- a/crates/libs/implement/Cargo.toml +++ b/crates/libs/implement/Cargo.toml @@ -22,3 +22,6 @@ proc-macro = true syn = { version = "2.0", default-features = false, features = ["parsing", "proc-macro", "printing", "full", "derive"] } quote = "1.0" proc-macro2 = "1.0" + +[dev-dependencies] +windows-core = { path = "../core" } diff --git a/crates/libs/implement/src/lib.rs b/crates/libs/implement/src/lib.rs index 55847b8ecf..043d1b1762 100644 --- a/crates/libs/implement/src/lib.rs +++ b/crates/libs/implement/src/lib.rs @@ -9,10 +9,9 @@ use quote::{quote, ToTokens}; /// Implements one or more COM interfaces. /// /// # Example +/// ```rust,no_run +/// use windows_core::*; /// -/// Here is a [more complete tutorial](https://kennykerr.ca/rust-getting-started/how-to-implement-com-interface.html). -/// -/// ```rust,ignore /// #[interface("094d70d6-5202-44b8-abb8-43860da5aca2")] /// unsafe trait IValue: IUnknown { /// fn GetValue(&self, value: *mut i32) -> HRESULT; @@ -21,18 +20,15 @@ use quote::{quote, ToTokens}; /// #[implement(IValue)] /// struct Value(i32); /// -/// impl IValue_Impl for Value { +/// impl IValue_Impl for Value_Impl { /// unsafe fn GetValue(&self, value: *mut i32) -> HRESULT { /// *value = self.0; /// HRESULT(0) /// } /// } /// -/// fn main() { -/// let rust_instance = Value(123); -/// let com_object: IValue = rust_instance.into(); -/// // You can now call interface methods on com_object. -/// } +/// let object: IValue = Value(123).into(); +/// // Call interface methods... /// ``` #[proc_macro_attribute] pub fn implement( diff --git a/crates/libs/interface/Cargo.toml b/crates/libs/interface/Cargo.toml index 9b797008a5..57ad5351d6 100644 --- a/crates/libs/interface/Cargo.toml +++ b/crates/libs/interface/Cargo.toml @@ -22,3 +22,6 @@ proc-macro = true syn = { version = "2.0", default-features = false, features = ["parsing", "proc-macro", "printing", "full", "derive", "clone-impls"] } quote = "1.0" proc-macro2 = "1.0" + +[dev-dependencies] +windows-core = { path = "../core" } diff --git a/crates/libs/interface/src/lib.rs b/crates/libs/interface/src/lib.rs index c2341b6c85..04b5234bc2 100644 --- a/crates/libs/interface/src/lib.rs +++ b/crates/libs/interface/src/lib.rs @@ -10,7 +10,9 @@ use syn::spanned::Spanned; /// Defines a COM interface to call or implement. /// /// # Example -/// ```rust,ignore +/// ```rust,no_run +/// use windows_core::*; +/// /// #[interface("094d70d6-5202-44b8-abb8-43860da5aca2")] /// unsafe trait IValue: IUnknown { /// fn GetValue(&self, value: *mut i32) -> HRESULT; @@ -19,17 +21,15 @@ use syn::spanned::Spanned; /// #[implement(IValue)] /// struct Value(i32); /// -/// impl IValue_Impl for Value { +/// impl IValue_Impl for Value_Impl { /// unsafe fn GetValue(&self, value: *mut i32) -> HRESULT { /// *value = self.0; /// HRESULT(0) /// } /// } /// -/// fn main() { -/// let object: IValue = Value(123).into(); -/// // Call interface methods... -/// } +/// let object: IValue = Value(123).into(); +/// // Call interface methods... /// ``` #[proc_macro_attribute] pub fn interface(