parent
98fdc1890d
commit
a277f3fd9d
@ -0,0 +1,33 @@
|
||||
//! Open post body
|
||||
use super::*;
|
||||
use tokio::{
|
||||
sync::{
|
||||
watch,
|
||||
mpsc,
|
||||
},
|
||||
};
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
/// An open post body
|
||||
#[derive(Debug)]
|
||||
pub struct Karada
|
||||
{
|
||||
scape: Vec<char>,
|
||||
|
||||
body_cache: String,
|
||||
//TODO: Pub/sub? Or should that be in some other place? Probably.
|
||||
}
|
||||
|
||||
impl Karada
|
||||
{
|
||||
fn invalidate_cache(&mut self)
|
||||
{
|
||||
self.body_cache = self.scape.iter().copied().collect();
|
||||
}
|
||||
/// Apply this delta to the body.
|
||||
pub fn apply_delta(&mut self, delta: &delta::Delta)
|
||||
{
|
||||
delta.insert(&mut self.scape);
|
||||
self.invalidate_cache();
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
pub mod user;
|
||||
pub mod post;
|
||||
pub mod body;
|
@ -0,0 +1,28 @@
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct OpenPost
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ClosedPost
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum PostKind
|
||||
{
|
||||
Open(OpenPost),
|
||||
Closed(ClosedPost),
|
||||
}
|
||||
|
||||
/// A post
|
||||
#[derive(Debug)]
|
||||
pub struct Post
|
||||
{
|
||||
owner: user::UserID,
|
||||
kind: PostKind
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
//! Used to determine which post belongs to who.
|
||||
//!
|
||||
//! Mostly for determining if a poster owns a post.
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Hash)]
|
||||
pub struct UserID(()); //TODO: User ID. Maybe use IP + session ID hash?
|
Loading…
Reference in new issue