Module declarative

Source
Expand description

Declarative forms of the #[ctor] and #[dtor] macros.

The declarative forms wrap and parse a proc_macro-like syntax like so, and are identical in expansion to the undecorated procedural macros. The declarative forms support the same attribute parameters as the procedural macros.

ctor::declarative::ctor! {
  #[ctor]
  fn foo() {
    libc_println!("Hello, world!");
  }
}

// ... the above is identical to:

#[ctor]
fn foo() {
  libc_println!("Hello, world!");
}

Macrosยง

ctor
Parse a #[ctor]-annotated item as if it were a proc-macro.
dtor
Parse a #[dtor]-annotated item as if it were a proc-macro.