Skip to content

Instantly share code, notes, and snippets.

@rylev
Forked from kennykerr/declare.rs
Last active July 24, 2020 15:42
Show Gist options
  • Save rylev/8c048d058bd145c585d6b247dec8639f to your computer and use it in GitHub Desktop.
Save rylev/8c048d058bd145c585d6b247dec8639f to your computer and use it in GitHub Desktop.
com::declare! {
// A COM interface declared here
#[uuid(...)]
pub interface IOldSchool {
fn foo();
fn bar();
}
// A COM class declared here (not defined here)
#[uuid(...)]
pub class ExternalClass : IOldSchool;
// A COM class defined here
#[uuid(...)]
pub class ExportedClass : IOldSchool {
my_field: usize,
}
// A local COM class defined here (no uuid needed)
class LocalClass : IOldSchool {...}
}
impl ExportedClass {
fn foo() { ... }
fn bar() { ... }
}
impl Default for ExportedClass {
fn default() -> Self { ... }
}
impl Default for LocalClass {
fn default() -> Self { ... }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment