You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yuurei/src/state/mod.rs

28 lines
454 B

use super::*;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use tokio::sync::RwLock;
use user::{User, UserID};
use post::Post;
mod freeze;
pub use freeze::*;
#[derive(Debug)]
struct Posts
{
users: HashMap<UserID, RwLock<User>>,
posts: HashMap<UserID, MaybeVec<RwLock<Post>>>,
}
#[derive(Debug)]
struct Inner
{
posts: RwLock<Posts>,
}
/// Contains all posts and users
#[derive(Debug, Clone)]
pub struct State(Arc<Inner>);