3 releases (breaking)

0.3.0 Nov 22, 2021
0.2.0 Sep 15, 2020
0.1.0 Jul 29, 2020

#605 in Procedural macros

Download history 14977/week @ 2022-10-08 16064/week @ 2022-10-15 16572/week @ 2022-10-22 16209/week @ 2022-10-29 15554/week @ 2022-11-05 15079/week @ 2022-11-12 14280/week @ 2022-11-19 15920/week @ 2022-11-26 16444/week @ 2022-12-03 15335/week @ 2022-12-10 14518/week @ 2022-12-17 8821/week @ 2022-12-24 13240/week @ 2022-12-31 14519/week @ 2023-01-07 16713/week @ 2023-01-14 14480/week @ 2023-01-21

60,325 downloads per month
Used in 1,276 crates (via ndk-glue)

MIT/Apache

28KB
703 lines

ndk-macro

Implementation of the attribute procedural macro main which applied directly to main function.

This macro is re-exported in ndk-glue. Typically, it's not needed to depend on this library directly!

Usage

#[cfg_attr(target_os = "android", ndk_glue::main(backtrace = "on"))]
pub fn main() {
    println!("hello world");
}

The attribute macro supports optional input attributes:

  • backtrace = "on|full": Enables backtraces by setting the RUST_BACKTRACE env var
  • ndk_glue = "path::to::ndk_glue": Overrides default path to ndk_glue crate
  • logger(...props): Configures android logger with the passed configuration (requires the logger feature):
    • level = "error|warn|info|debug|trace": Changes log level for logger
    • tag = "my-tag": Assigns tag to logger
    • filter = "filtering-rules": Changes default filtering rules

Dependencies

~3MB
~60K SLoC