From da17bab18baa02e4e33d8af1309811a603ae4694 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 21 Jun 2026 22:34:45 -0400 Subject: [PATCH] cargo fmt --- src/app.rs | 42 +++++++++++++++++++++--------------------- src/main.rs | 5 ++++- src/service.rs | 8 ++++---- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/app.rs b/src/app.rs index 18d3c9f..d637aa0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,18 +1,17 @@ /// Seconds to sleep after finising a task pub const SECONDS_TO_SLEEP: u64 = 5; - pub const APP_NAME: &str = "catapult"; pub struct App { - pub api_url: String, - pub auth_url: String, - pub service_username: String, - pub service_passphrase: String, - pub twilio_config: textsender_models::config::auxiliary::TwilioConfig, + pub api_url: String, + pub auth_url: String, + pub service_username: String, + pub service_passphrase: String, + pub twilio_config: textsender_models::config::auxiliary::TwilioConfig, } -// TODO: Change this to non-async at some point. +// TODO: Change this to non-async at some point. // Will require changes in other libraries pub async fn load_app() -> Result { use textsender_models::envy; @@ -21,7 +20,12 @@ pub async fn load_app() -> Result { let service_username_env = envy::environment::get_env("SERVICE_USERNAME").await; let service_passphrase_env = envy::environment::get_env("SERVICE_PASSPHRASE").await; - let envs = vec![auth_url_env, api_url_env, service_username_env, service_passphrase_env]; + let envs = vec![ + auth_url_env, + api_url_env, + service_username_env, + service_passphrase_env, + ]; let check_envs = |vs: &Vec| -> (bool, Option) { for env in vs { @@ -33,21 +37,17 @@ pub async fn load_app() -> Result { }; let (envs_valid, reason) = check_envs(&envs); - + if envs_valid { match textsender_models::config::auxiliary::load_config().await { - Ok(twilio_config) => { - Ok(App { - api_url: String::new(), - auth_url: String::new(), - service_username: String::new(), - service_passphrase: String::new(), - twilio_config: twilio_config - }) - } - Err(err) => { - Err(err) - } + Ok(twilio_config) => Ok(App { + api_url: String::new(), + auth_url: String::new(), + service_username: String::new(), + service_passphrase: String::new(), + twilio_config: twilio_config, + }), + Err(err) => Err(err), } } else { Err(std::io::Error::other(reason.unwrap())) diff --git a/src/main.rs b/src/main.rs index 246d932..80bfe63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,9 @@ async fn main() -> Result<(), Box> { loop { catapult::service::do_the_work(&app).await; - tokio::time::sleep(tokio::time::Duration::from_secs(catapult::app::SECONDS_TO_SLEEP)).await; + tokio::time::sleep(tokio::time::Duration::from_secs( + catapult::app::SECONDS_TO_SLEEP, + )) + .await; } } diff --git a/src/service.rs b/src/service.rs index 9dd4cb4..93bb630 100644 --- a/src/service.rs +++ b/src/service.rs @@ -1,8 +1,7 @@ - - pub async fn do_the_work(_app: &crate::app::App) { println!("Do some work"); - todo!(r#" + todo!( + r#" Need to finish this This function should fetch a token, check if the token is valid, and obtain a refresh token if @@ -18,5 +17,6 @@ pub async fn do_the_work(_app: &crate::app::App) { 6. Get the contact 7. Send the message 8. Record the message event response - "#); + "# + ); }