load("@rules_rust//bindgen:defs.bzl", "rust_bindgen_library") load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test") rust_bindgen_library( name = "simple_bindgen", bindgen_flags = [ "--allowlist-function=simple_.*", "--allowlist-var=SIMPLE_.*", ], cc_lib = "//bindgen/simple", header = "//bindgen/simple:simple.h", leak_symbols = False, ) rust_binary( name = "simple_example", srcs = ["main.rs"], deps = [":simple_bindgen"], ) rust_test( name = "simple_test", crate = ":simple_example", ) rust_bindgen_library( name = "simple_leaked_bindgen", bindgen_flags = [ "--allowlist-function=simple_.*", "--allowlist-var=SIMPLE_.*", ], cc_lib = "//bindgen/simple", header = "//bindgen/simple:simple.h", leak_symbols = True, ) rust_binary( name = "simple_leaked_example", srcs = ["main_leaked.rs"], deps = [":simple_leaked_bindgen"], ) rust_test( name = "simple_leaked_test", crate = ":simple_leaked_example", )