From 80ed00f79667c3b98e233004ae0aefafc0e17826 Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Wed, 13 Aug 2025 00:21:36 -0300 Subject: [PATCH] Add documentation for main.rs --- src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.rs b/src/main.rs index 46395ec..d99dfa8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,6 +139,10 @@ mod logging; mod state; mod utils; +/// Payphone's main entrypoint function. +/// +/// Parses ENV variables and CLI arguments, sets up the logger, and runs [`start`] or [`docs`] +/// depending on the command. #[tokio::main] pub async fn main() { dotenvy::dotenv().ok(); @@ -162,6 +166,9 @@ pub async fn main() { } } +/// Starts a Payphone shard. +/// +/// TODO: Support multiple shards. async fn start(token: String, database_addr: String) { log::info!("Welcome to Payphone, Nyeki!"); log::info!( @@ -195,6 +202,10 @@ async fn start(token: String, database_addr: String) { bot.run(&token).await.expect("Could not run bot!"); } +/// Boots up a documentation server. +/// +/// It compiles the crate's documentation and recompiles it automatically when the source code +/// changes. async fn docs(bind: SocketAddr, open_on_start: bool) { log::info!("Compiling documentation...");