Skip to main content

nominal_api/
lib.rs

1// compile_error if both conjure and tonic are disabled — the crate would be empty
2#[cfg(not(any(feature = "conjure", feature = "tonic")))]
3compile_error!("at least one of the `conjure` or `tonic` features must be enabled");
4
5// Bazel (build_bazel.rs) or generate-bindings (build.rs): codegen into OUT_DIR at build time
6#[cfg(all(feature = "conjure", any(bazel, feature = "generate-bindings")))]
7mod conjure {
8    include!(concat!(env!("OUT_DIR"), "/conjure/mod.rs"));
9}
10
11// Default Cargo: pre-generated into src/conjure/ (not active during _build pre-gen step)
12#[cfg(all(feature = "conjure", not(any(bazel, feature = "generate-bindings")), not(feature = "_build")))]
13mod conjure;
14
15// Bazel or generate-bindings: proto stubs generated at build time into OUT_DIR
16#[cfg(all(any(bazel, feature = "generate-bindings"), feature = "tonic"))]
17mod proto {
18    include!(concat!(env!("OUT_DIR"), "/proto/mod.rs"));
19}
20
21// Default Cargo: proto stubs pre-generated into src/proto/ (not active during _build pre-gen step)
22#[cfg(all(
23    not(any(bazel, feature = "generate-bindings")),
24    feature = "tonic",
25    not(feature = "_build")
26))]
27mod proto;
28
29#[cfg(all(any(bazel, not(feature = "_build")), feature = "tonic"))]
30pub mod tonic {
31    pub use crate::proto::*;
32}
33
34#[cfg(all(feature = "conjure", not(feature = "_build")))]
35pub use conjure::*;