Add futures.
This commit is contained in:
parent
5f93cabff5
commit
182c2737cd
@ -38,6 +38,7 @@ path = "src/lib.rs"
|
||||
required-features = ["foreign_document_test"]
|
||||
|
||||
[dependencies]
|
||||
futures = { version = "0.3.28", optional = true }
|
||||
nom = "7.1.1"
|
||||
opentelemetry = { version = "0.20.0", optional = true, default-features = false, features = ["trace", "rt-tokio"] }
|
||||
opentelemetry-otlp = { version = "0.13.0", optional = true }
|
||||
@ -53,7 +54,7 @@ walkdir = "2.3.3"
|
||||
[features]
|
||||
default = ["compare", "foreign_document_test"]
|
||||
compare = []
|
||||
foreign_document_test = ["compare", "dep:tokio"]
|
||||
foreign_document_test = ["compare", "dep:tokio", "dep:futures"]
|
||||
tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"]
|
||||
|
||||
# Optimized build for any sort of release.
|
||||
|
@ -4,6 +4,9 @@ use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
use futures::future::FutureExt;
|
||||
use futures::stream::FuturesUnordered;
|
||||
use organic::compare::run_anonymous_compare;
|
||||
use organic::compare::run_compare_on_file;
|
||||
|
||||
@ -41,8 +44,9 @@ async fn main_body() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let single_file = TestConfig::SingleFile(SingleFile {
|
||||
file_path: PathBuf::from("/tmp/test.org"),
|
||||
});
|
||||
let mut futs = FuturesUnordered::new();
|
||||
// let result = single_file.run_test().await;
|
||||
let result = tokio::spawn(single_file.run_test());
|
||||
let result = tokio::spawn(single_file.run_test()).await;
|
||||
println!("{:?}", result);
|
||||
// let test_config = TestConfig::TestLayer(TestLayer {
|
||||
// name: "foo",
|
||||
@ -95,11 +99,14 @@ pub(crate) enum TestStatus {
|
||||
}
|
||||
|
||||
impl TestConfig {
|
||||
async fn run_test(self) -> TestResult {
|
||||
match self {
|
||||
TestConfig::TestLayer(test) => TestResult::ResultLayer(test.run_test().await),
|
||||
TestConfig::SingleFile(test) => TestResult::SingleFileResult(test.run_test().await),
|
||||
fn run_test(self) -> BoxFuture<'static, TestResult> {
|
||||
async move {
|
||||
match self {
|
||||
TestConfig::TestLayer(test) => TestResult::ResultLayer(test.run_test().await),
|
||||
TestConfig::SingleFile(test) => TestResult::SingleFileResult(test.run_test().await),
|
||||
}
|
||||
}
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user