Skip to content

Commit f8124e8

Browse files
authored
Fix macro docs (#3378)
1 parent 0a68b66 commit f8124e8

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

crates/libs/implement/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ proc-macro = true
2222
syn = { version = "2.0", default-features = false, features = ["parsing", "proc-macro", "printing", "full", "derive"] }
2323
quote = "1.0"
2424
proc-macro2 = "1.0"
25+
26+
[dev-dependencies]
27+
windows-core = { path = "../core" }

crates/libs/implement/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ use quote::{quote, ToTokens};
99
/// Implements one or more COM interfaces.
1010
///
1111
/// # Example
12+
/// ```rust,no_run
13+
/// use windows_core::*;
1214
///
13-
/// Here is a [more complete tutorial](https://kennykerr.ca/rust-getting-started/how-to-implement-com-interface.html).
14-
///
15-
/// ```rust,ignore
1615
/// #[interface("094d70d6-5202-44b8-abb8-43860da5aca2")]
1716
/// unsafe trait IValue: IUnknown {
1817
/// fn GetValue(&self, value: *mut i32) -> HRESULT;
@@ -21,18 +20,15 @@ use quote::{quote, ToTokens};
2120
/// #[implement(IValue)]
2221
/// struct Value(i32);
2322
///
24-
/// impl IValue_Impl for Value {
23+
/// impl IValue_Impl for Value_Impl {
2524
/// unsafe fn GetValue(&self, value: *mut i32) -> HRESULT {
2625
/// *value = self.0;
2726
/// HRESULT(0)
2827
/// }
2928
/// }
3029
///
31-
/// fn main() {
32-
/// let rust_instance = Value(123);
33-
/// let com_object: IValue = rust_instance.into();
34-
/// // You can now call interface methods on com_object.
35-
/// }
30+
/// let object: IValue = Value(123).into();
31+
/// // Call interface methods...
3632
/// ```
3733
#[proc_macro_attribute]
3834
pub fn implement(

crates/libs/interface/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ proc-macro = true
2222
syn = { version = "2.0", default-features = false, features = ["parsing", "proc-macro", "printing", "full", "derive", "clone-impls"] }
2323
quote = "1.0"
2424
proc-macro2 = "1.0"
25+
26+
[dev-dependencies]
27+
windows-core = { path = "../core" }

crates/libs/interface/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use syn::spanned::Spanned;
1010
/// Defines a COM interface to call or implement.
1111
///
1212
/// # Example
13-
/// ```rust,ignore
13+
/// ```rust,no_run
14+
/// use windows_core::*;
15+
///
1416
/// #[interface("094d70d6-5202-44b8-abb8-43860da5aca2")]
1517
/// unsafe trait IValue: IUnknown {
1618
/// fn GetValue(&self, value: *mut i32) -> HRESULT;
@@ -19,17 +21,15 @@ use syn::spanned::Spanned;
1921
/// #[implement(IValue)]
2022
/// struct Value(i32);
2123
///
22-
/// impl IValue_Impl for Value {
24+
/// impl IValue_Impl for Value_Impl {
2325
/// unsafe fn GetValue(&self, value: *mut i32) -> HRESULT {
2426
/// *value = self.0;
2527
/// HRESULT(0)
2628
/// }
2729
/// }
2830
///
29-
/// fn main() {
30-
/// let object: IValue = Value(123).into();
31-
/// // Call interface methods...
32-
/// }
31+
/// let object: IValue = Value(123).into();
32+
/// // Call interface methods...
3333
/// ```
3434
#[proc_macro_attribute]
3535
pub fn interface(

0 commit comments

Comments
 (0)