Skip to content

Commit 19765db

Browse files
committed
Add tensorflow_unstable feature gate
1 parent 9ae057b commit 19765db

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ repository = "https://github.com/google/tensorflow-rust"
1111
[dependencies]
1212
libc = "^0.2"
1313
libtensorflow-sys = { path = "libtensorflow-sys" }
14+
15+
[features]
16+
default = []
17+
tensorflow_unstable = []

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ and $TENSORFLOW_SRC/bazel-bin/tensorflow to LD_LIBRARY_PATH.
2626
You may need to run `ldconfig` to reset `ld`'s cache after copying libtensorflow.so.
2727

2828
Now run `cargo build` as usual.
29+
To include the unstable API (which is currently the entire API), use `--features tensorflow_unstable`.
30+
31+
## FAQs
32+
33+
#### Why are the docs empty?
34+
Run `cargo doc --features tensorflow_unstable`.
35+
See below.
36+
37+
#### Why are no tests running?
38+
Run `cargo test --features tensorflow_unstable`.
39+
See below.
40+
41+
#### Why does the compiler say that none of the API exists?
42+
The unstable parts of the API (which is currently the entire API) are
43+
feature-gated behind the feature `tensorflow_unstable` to prevent accidental
44+
use. See http://doc.crates.io/manifest.html#the-features-section.
45+
(We would prefer using an `#[unstable]` attribute, but that
46+
[doesn't exist](https://github.com/rust-lang/rfcs/issues/1491) yet.)
2947

3048
## Other
3149

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "tensorflow_unstable")]
2+
13
extern crate libc;
24
extern crate libtensorflow_sys;
35

0 commit comments

Comments
 (0)