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/body.rs

34 lines
578 B

//! 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();
}
}