You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
625 B
Rust
29 lines
625 B
Rust
use std::sync::Arc;
|
|
|
|
use parking_lot::Mutex;
|
|
use serenity::prelude::TypeMapKey;
|
|
|
|
use crate::database::Database;
|
|
|
|
pub struct Store;
|
|
|
|
pub struct StoreData {
|
|
pub database: Arc<Mutex<Database>>,
|
|
pub minecraft_data_api: minecraft_data_rs::api::Api,
|
|
}
|
|
|
|
impl StoreData {
|
|
pub fn new(database: Database) -> StoreData {
|
|
Self {
|
|
database: Arc::new(Mutex::new(database)),
|
|
minecraft_data_api: minecraft_data_rs::api::Api::new(
|
|
minecraft_data_rs::api::versions::latest_stable().unwrap(),
|
|
),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl TypeMapKey for Store {
|
|
type Value = StoreData;
|
|
}
|