Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Dec 10, 2024
1 parent 2291719 commit 3e492c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions crates/libs/implement/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
12 changes: 5 additions & 7 deletions crates/libs/implement/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,17 +20,16 @@ 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]
Expand Down
3 changes: 3 additions & 0 deletions crates/libs/interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
6 changes: 4 additions & 2 deletions crates/libs/interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +21,7 @@ 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)
Expand Down

0 comments on commit 3e492c1

Please sign in to comment.