Skip to content

Commit 8c4d831

Browse files
committed
fix no default features
1 parent a3bef55 commit 8c4d831

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ rustdoc-args = ["--cfg", "iroh_docsrs"]
129129

130130
[[example]]
131131
name = "provide-bytes"
132+
required-features = ["formats-collection"]
132133

133134
[[example]]
134135
name = "fetch-fsm"

src/store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub mod fs;
1313
mod fetch_to_db;
1414
pub use fetch_to_db::{fetch_to_db, fetch_to_db_in_steps, FetchState, FetchStateNeedsConn};
1515
mod export;
16-
pub use export::{export, export_blob, export_collection, ExportProgress};
16+
#[cfg(feature = "formats-collection")]
17+
pub use export::export_collection;
18+
pub use export::{export, export_blob, ExportProgress};
1719

1820
mod traits;
1921
use tracing::warn;

src/store/export.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use serde::{Deserialize, Serialize};
88
use tracing::trace;
99

1010
use crate::{
11-
format::collection::Collection,
1211
store::{BaoBlobSize, ExportFormat, ExportMode, MapEntry, Store as BaoStore},
1312
util::progress::{IdGenerator, ProgressSender},
1413
Hash,
@@ -32,11 +31,13 @@ pub async fn export<D: BaoStore>(
3231
) -> anyhow::Result<()> {
3332
match format {
3433
ExportFormat::Blob => export_blob(db, hash, outpath, mode, progress).await,
34+
#[cfg(feature = "formats-collection")]
3535
ExportFormat::Collection => export_collection(db, hash, outpath, mode, progress).await,
3636
}
3737
}
3838

3939
/// Export all entries of a collection, recursively, to files on the local filesystem.
40+
#[cfg(feature = "formats-collection")]
4041
pub async fn export_collection<D: BaoStore>(
4142
db: &D,
4243
hash: Hash,
@@ -45,7 +46,7 @@ pub async fn export_collection<D: BaoStore>(
4546
progress: impl ProgressSender<Msg = ExportProgress> + IdGenerator,
4647
) -> anyhow::Result<()> {
4748
tokio::fs::create_dir_all(&outpath).await?;
48-
let collection = Collection::load_db(db, &hash).await?;
49+
let collection = crate::format::collection::Collection::load_db(db, &hash).await?;
4950
for (name, hash) in collection.into_iter() {
5051
#[allow(clippy::needless_borrow)]
5152
let path = outpath.join(pathbuf_from_name(&name));
@@ -126,6 +127,7 @@ pub enum ExportProgress {
126127
Abort(serde_error::Error),
127128
}
128129

130+
#[cfg(feature = "formats-collection")]
129131
fn pathbuf_from_name(name: &str) -> PathBuf {
130132
let mut path = PathBuf::new();
131133
for part in name.split('/') {

src/store/traits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ pub enum ExportFormat {
819819
/// destination path.
820820
///
821821
/// If the blob cannot be parsed as a collection, the operation will fail.
822+
#[cfg(feature = "formats-collection")]
822823
Collection,
823824
}
824825

0 commit comments

Comments
 (0)