Starting to define a TestConfig enum.

This commit is contained in:
Tom Alexander 2023-10-07 01:13:26 -04:00
parent fd141762f0
commit 591b5ed382
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -16,7 +16,7 @@ mod init_tracing;
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let rt = tokio::runtime::Runtime::new()?; let rt = tokio::runtime::Runtime::new()?;
let result = rt.block_on(async { let result = rt.block_on(async {
let main_body_result = main_body(); let main_body_result = main_body().await;
main_body_result main_body_result
}); });
result result
@ -27,7 +27,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let rt = tokio::runtime::Runtime::new()?; let rt = tokio::runtime::Runtime::new()?;
let result = rt.block_on(async { let result = rt.block_on(async {
init_telemetry()?; init_telemetry()?;
let main_body_result = main_body(); let main_body_result = main_body().await;
shutdown_telemetry()?; shutdown_telemetry()?;
main_body_result main_body_result
}); });
@ -35,7 +35,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn main_body() -> Result<(), Box<dyn std::error::Error>> { async fn main_body() -> Result<(), Box<dyn std::error::Error>> {
let args = std::env::args().skip(1); let args = std::env::args().skip(1);
if args.is_empty() { if args.is_empty() {
let org_contents = read_stdin_to_string()?; let org_contents = read_stdin_to_string()?;
@ -55,3 +55,25 @@ fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
.read_to_string(&mut stdin_contents)?; .read_to_string(&mut stdin_contents)?;
Ok(stdin_contents) Ok(stdin_contents)
} }
#[derive(Debug)]
enum TestConfig<'s> {
TestLayer(TestLayer<'s>),
SingleFile(SingleFile<'s>),
AnonymousFile(AnonymousFile),
}
#[derive(Debug)]
struct TestLayer<'s> {
name: &'s str,
}
#[derive(Debug)]
struct SingleFile<'s> {
name: &'s str,
}
#[derive(Debug)]
struct AnonymousFile<'s> {
name: String,
}