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