//! Application state at runtime including shared resources. //! //! Currently, it only contains the database connection, but it can be extended in the future to //! include other resources that need to be shared across the application, such as caches or //! configuration settings. //! //! It is shared around the application using an `Arc`, allowing it to be cloned and passed around //! without needing to worry about ownership or lifetimes. This is particularly useful in an //! asynchronous context. //! //! ``` //! let state = State { //! db: database::init("127.0.0.1:9042").await?, //! }; //! //! fn handler_which_needs_state(state: Arc) { //! // Use the state here //! } //! ``` use deadpool_redis::cluster::Pool; use scylla::client::session::Session; use tokio::sync::mpsc::Sender; use crate::colors::AvatarColorFetchingRequest; pub struct State { pub db: Session, pub redis: Pool, pub bot_owner_id: u64, pub color_queue_sender: Sender, }