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.
28 lines
454 B
28 lines
454 B
4 years ago
|
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>);
|