Skip to main content

_native/
lib.rs

1//! Python bindings entrypoint
2//!
3//! The real PyO3 bindings live in `bindings.rs` and are only compiled when
4//! the `python-bindings` feature is enabled. Without that feature, we build a
5//! stub so `cargo test --workspace` can run on hosts without a Python toolchain.
6
7#![allow(dead_code)]
8
9#[cfg(feature = "python-bindings")]
10mod bindings;
11#[cfg(not(feature = "python-bindings"))]
12mod stub;
13
14#[cfg(feature = "python-bindings")]
15pub use bindings::*;
16#[cfg(not(feature = "python-bindings"))]
17pub use stub::*;
18
19#[cfg(test)]
20mod feature_flags {
21    use super::*;
22
23    #[cfg(feature = "python-bindings")]
24    #[test]
25    fn bindings_feature_flag_true() {
26        assert!(PYTHON_BINDINGS_ENABLED);
27    }
28
29    #[cfg(not(feature = "python-bindings"))]
30    #[test]
31    fn bindings_feature_flag_false() {
32        assert!(!PYTHON_BINDINGS_ENABLED);
33    }
34}