abrasion/third_party/cargo/vendor/ndk-macro-0.2.0
q3k 2938a31682 third_party: bump everything 2021-01-07 23:38:16 +00:00
..
src third_party: bump everything 2021-01-07 23:38:16 +00:00
.cargo-checksum.json third_party: bump everything 2021-01-07 23:38:16 +00:00
BUILD.bazel third_party: bump everything 2021-01-07 23:38:16 +00:00
CHANGELOG.md third_party: bump everything 2021-01-07 23:38:16 +00:00
Cargo.toml third_party: bump everything 2021-01-07 23:38:16 +00:00
README.md third_party: bump everything 2021-01-07 23:38:16 +00:00

README.md

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
    • android_logger = "path::to::android_logger": Overrides default path to android_logger crate
    • log = "path::to::log": Overrides default path to log crate