3 releases (breaking)

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

#1136 in Procedural macros

Download history 16396/week @ 2024-11-15 14444/week @ 2024-11-22 15837/week @ 2024-11-29 17199/week @ 2024-12-06 16262/week @ 2024-12-13 8011/week @ 2024-12-20 5525/week @ 2024-12-27 13463/week @ 2025-01-03 18987/week @ 2025-01-10 16071/week @ 2025-01-17 16242/week @ 2025-01-24 14942/week @ 2025-01-31 17791/week @ 2025-02-07 17410/week @ 2025-02-14 18367/week @ 2025-02-21 15471/week @ 2025-02-28

72,123 downloads per month
Used in 969 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

~4MB
~96K SLoC