From f874e59a11253968a357690b499c84ca4a1834fa Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 10 Aug 2023 14:20:11 +0300 Subject: [PATCH] fix convert feature without source --- app_async/Cargo.toml | 2 +- lib/Cargo.toml | 11 +++++++++-- lib/src/lib.rs | 7 ++++++- lib/src/source.rs | 8 ++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app_async/Cargo.toml b/app_async/Cargo.toml index c176811..9efcccb 100644 --- a/app_async/Cargo.toml +++ b/app_async/Cargo.toml @@ -10,7 +10,7 @@ description = "Утилита загружающая базу данных ЧГ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -chgk_ledb_lib = {path = "../lib", features = ["async", "source_async", "convert_async"]} +chgk_ledb_lib = {path = "../lib", features = ["async", "convert_async"]} serde_json="1.0" async_zip = { git = "https://github.com/Majored/rs-async-zip", rev = "ff0d985", features = [ "zstd", diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 286285c..840a20b 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -30,8 +30,15 @@ source_async = [ "futures-util", "async-stream", ] -convert = [] -convert_async = ["futures", "futures-core", "futures-util", "async-stream"] +convert = ["zip"] +convert_async = [ + "futures", + "futures-core", + "futures-util", + "async-stream", + "async_zip", + "tokio", +] [dependencies] serde = "1.0" diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 9288f96..3f95dea 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -3,6 +3,11 @@ pub mod async_db; #[cfg(feature = "sync")] pub mod db; pub mod questions; -#[cfg(any(feature = "source", feature = "source_async"))] +#[cfg(any( + feature = "source", + feature = "source_async", + feature = "convert", + feature = "convert_async" +))] pub mod source; pub mod util; diff --git a/lib/src/source.rs b/lib/src/source.rs index 81d02dc..cbe0bd3 100644 --- a/lib/src/source.rs +++ b/lib/src/source.rs @@ -103,7 +103,7 @@ pub struct SourceQuestionsBatch { pub questions: Vec, } -#[cfg(feature = "source")] +#[cfg(any(feature = "convert", feature = "source"))] pub mod reader_sync { use std::io::{Read, Seek}; use zip::ZipArchive; @@ -211,10 +211,10 @@ pub mod reader_sync { } } -#[cfg(feature = "source")] +#[cfg(any(feature = "convert", feature = "source"))] pub use reader_sync::{ReadSourceQuestionsBatches, SourceQuestionsZipReader}; -#[cfg(feature = "source_async")] +#[cfg(any(feature = "convert_async", feature = "source_async"))] pub mod reader_async { use async_stream::stream; use async_zip::tokio::read::seek::ZipFileReader; @@ -326,5 +326,5 @@ pub mod reader_async { } } } -#[cfg(feature = "source_async")] +#[cfg(any(feature = "convert_async", feature = "source_async"))] pub use reader_async::{ReadSourceQuestionsBatchesAsync, SourceQuestionsZipReaderAsync};