1load("//tools/buck:rust_cxx_bridge.bzl", "rust_cxx_bridge") 2 3rust_test( 4 name = "test", 5 srcs = ["test.rs"], 6 edition = "2018", 7 deps = [ 8 ":ffi", 9 "//:cxx", 10 ], 11) 12 13rust_library( 14 name = "ffi", 15 srcs = [ 16 "ffi/cast.rs", 17 "ffi/lib.rs", 18 "ffi/module.rs", 19 ], 20 crate = "cxx_test_suite", 21 edition = "2018", 22 deps = [ 23 ":impl", 24 "//:cxx", 25 ], 26) 27 28cxx_library( 29 name = "impl", 30 srcs = [ 31 "ffi/tests.cc", 32 ":bridge/source", 33 ":module/source", 34 ], 35 exported_deps = ["//:core"], 36 exported_headers = { 37 "ffi/lib.rs.h": ":bridge/header", 38 "ffi/module.rs.h": ":module/header", 39 "ffi/tests.h": "ffi/tests.h", 40 }, 41) 42 43rust_cxx_bridge( 44 name = "bridge", 45 src = "ffi/lib.rs", 46 deps = [ 47 ":impl", 48 ], 49) 50 51rust_cxx_bridge( 52 name = "module", 53 src = "ffi/module.rs", 54 deps = [ 55 ":impl", 56 ], 57) 58