fix convert feature without source
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dmitry Belyaev 2023-08-10 14:20:11 +03:00
parent 9c4882fbbb
commit f874e59a11
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
4 changed files with 20 additions and 8 deletions

View File

@ -10,7 +10,7 @@ description = "Утилита загружающая базу данных ЧГ
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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" serde_json="1.0"
async_zip = { git = "https://github.com/Majored/rs-async-zip", rev = "ff0d985", features = [ async_zip = { git = "https://github.com/Majored/rs-async-zip", rev = "ff0d985", features = [
"zstd", "zstd",

View File

@ -30,8 +30,15 @@ source_async = [
"futures-util", "futures-util",
"async-stream", "async-stream",
] ]
convert = [] convert = ["zip"]
convert_async = ["futures", "futures-core", "futures-util", "async-stream"] convert_async = [
"futures",
"futures-core",
"futures-util",
"async-stream",
"async_zip",
"tokio",
]
[dependencies] [dependencies]
serde = "1.0" serde = "1.0"

View File

@ -3,6 +3,11 @@ pub mod async_db;
#[cfg(feature = "sync")] #[cfg(feature = "sync")]
pub mod db; pub mod db;
pub mod questions; 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 source;
pub mod util; pub mod util;

View File

@ -103,7 +103,7 @@ pub struct SourceQuestionsBatch {
pub questions: Vec<SourceQuestion>, pub questions: Vec<SourceQuestion>,
} }
#[cfg(feature = "source")] #[cfg(any(feature = "convert", feature = "source"))]
pub mod reader_sync { pub mod reader_sync {
use std::io::{Read, Seek}; use std::io::{Read, Seek};
use zip::ZipArchive; 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}; pub use reader_sync::{ReadSourceQuestionsBatches, SourceQuestionsZipReader};
#[cfg(feature = "source_async")] #[cfg(any(feature = "convert_async", feature = "source_async"))]
pub mod reader_async { pub mod reader_async {
use async_stream::stream; use async_stream::stream;
use async_zip::tokio::read::seek::ZipFileReader; 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}; pub use reader_async::{ReadSourceQuestionsBatchesAsync, SourceQuestionsZipReaderAsync};