From 956d6915a575732cb3d228b811789fba9c6bcd36 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Mon, 19 Aug 2024 14:49:56 -0400 Subject: [PATCH] attic: Split out stream feature Right now it just depends on tokio, but the goal is to support alternative async runtimes. --- attic/Cargo.toml | 17 +++++++++++------ attic/src/lib.rs | 2 +- server/Cargo.toml | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/attic/Cargo.toml b/attic/Cargo.toml index 957bb02..4cf79f2 100644 --- a/attic/Cargo.toml +++ b/attic/Cargo.toml @@ -50,14 +50,19 @@ tempfile = "3" version-compare = "0.2.0" [features] -default = [ "nix_store", "tokio" ] +default = [ + "nix_store", + "stream", + "tokio", +] # Native libnixstore bindings. # # When disabled, the native Rust portions of nix_store can still be used. -nix_store = [ "dep:cxx", "dep:cxx-build", "tokio/rt" ] +nix_store = ["tokio", "dep:cxx", "dep:cxx-build"] -# Tokio. -# -# When disabled, any part depending on tokio is unavailable. -tokio = [ "dep:tokio", "dep:async-stream" ] +# Stream utilities. +stream = ["tokio", "dep:async-stream"] + +# Tokio runtime. +tokio = ["dep:tokio", "tokio/rt"] diff --git a/attic/src/lib.rs b/attic/src/lib.rs index 05c1f52..04ff0fd 100644 --- a/attic/src/lib.rs +++ b/attic/src/lib.rs @@ -22,7 +22,7 @@ pub mod hash; pub mod mime; pub mod nix_store; pub mod signing; -#[cfg(feature = "tokio")] +#[cfg(feature = "stream")] pub mod stream; #[cfg(target_family = "unix")] pub mod testing; diff --git a/server/Cargo.toml b/server/Cargo.toml index a4794d3..ec50929 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -19,7 +19,7 @@ path = "src/adm/main.rs" doc = false [dependencies] -attic = { path = "../attic", default-features = false, features = [ "tokio" ] } +attic = { path = "../attic", default-features = false, features = ["stream", "tokio"] } attic-token = { path = "../token" } anyhow = "1.0.71"