attic: Allow disabling tokio

Not needed at all for parsing usecases.
This commit is contained in:
Zhaofeng Li 2023-01-08 00:57:22 -07:00
parent 6969af2d5e
commit eb34b8ee99
3 changed files with 11 additions and 3 deletions

View file

@ -28,6 +28,7 @@ cxx = { version = "1.0", optional = true }
[dependencies.tokio]
version = "1.23.0"
optional = true
features = [
"fs",
"io-util",
@ -45,9 +46,14 @@ cxx-build = { version = "1.0", optional = true }
pkg-config = "0.3.26"
[features]
default = [ "nix_store" ]
default = [ "nix_store", "tokio" ]
# Native libnixstore bindings.
#
# When disabled, the native Rust portions of nix_store can still be used.
nix_store = [ "cxx", "bindgen", "cxx-build" ]
nix_store = [ "dep:cxx", "dep:bindgen", "dep:cxx-build" ]
# Tokio.
#
# When disabled, any part depending on tokio is unavailable.
tokio = [ "dep:tokio" ]

View file

@ -22,8 +22,10 @@ pub mod hash;
pub mod mime;
pub mod nix_store;
pub mod signing;
#[cfg(feature = "tokio")]
pub mod stream;
pub mod testing;
#[cfg(feature = "tokio")]
pub mod util;
pub use error::{AtticError, AtticResult};

View file

@ -19,7 +19,7 @@ path = "src/adm/main.rs"
doc = false
[dependencies]
attic = { path = "../attic", default-features = false }
attic = { path = "../attic", default-features = false, features = [ "tokio" ] }
attic-token = { path = "../token" }
anyhow = "1.0.68"