mirror of
https://github.com/dsec-hub/dsec-discord-bot.git
synced 2026-09-22 07:44:26 +00:00
removed Arc
This commit is contained in:
parent
e4b1904c93
commit
f7b9f73bec
2 changed files with 7 additions and 10 deletions
|
|
@ -12,4 +12,4 @@ serenity = "0.12"
|
||||||
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] }
|
||||||
tracing-subscriber = "0.3.20"
|
tracing-subscriber = "0.3.20"
|
||||||
supabase-lib-rs = "0.5.3"
|
supabase-lib-rs = "0.5.3"
|
||||||
serde = "1.0.228"
|
serde = "1.0.228"
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -1,9 +1,6 @@
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use poise::serenity_prelude as serenity;
|
use poise::serenity_prelude as serenity;
|
||||||
use std::{
|
use std::{collections::HashMap, sync::Mutex};
|
||||||
collections::HashMap,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
use supabase::Client;
|
use supabase::Client;
|
||||||
mod commands;
|
mod commands;
|
||||||
mod events;
|
mod events;
|
||||||
|
|
@ -18,10 +15,10 @@ type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||||
type Context<'a> = poise::Context<'a, Data, Error>;
|
type Context<'a> = poise::Context<'a, Data, Error>;
|
||||||
type ApplicationContext<'a> = poise::ApplicationContext<'a, Data, Error>;
|
type ApplicationContext<'a> = poise::ApplicationContext<'a, Data, Error>;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
pub supabase: Arc<Client>,
|
pub supabase: Client,
|
||||||
pub student_cache: Arc<Mutex<HashMap<String, String>>>,
|
pub student_cache: Mutex<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
|
|
@ -32,8 +29,8 @@ impl AppState {
|
||||||
let client = Client::new(&supabase_url, &supabase_key)?;
|
let client = Client::new(&supabase_url, &supabase_key)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
supabase: Arc::new(client),
|
supabase: client,
|
||||||
student_cache: Arc::new(Mutex::new(HashMap::new())),
|
student_cache: Mutex::new(HashMap::new()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue