diff --git a/src/ext.rs b/src/ext.rs index 90908cb..6d09910 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -156,6 +156,7 @@ impl VecExt for Vec Err(e) => { // memory at (location+sent)..slen is now invalid, move the old one back before allowing unwind to contine libc::memmove(this.add(sent) as *mut libc::c_void, this.add(slen) as *mut libc::c_void, rest); + self.set_len(len + sent); std::panic::resume_unwind(e) }, _ => (), diff --git a/src/state/mod.rs b/src/state/mod.rs index 760a4b6..e2216e6 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -7,9 +7,23 @@ pub use global::*; mod local; pub use local::*; +#[derive(Debug)] /// An open or closed post pub enum Post { Open(Imouto), Closed(post::Static), } + +impl Post +{ + /// Is this post open + #[inline] pub fn is_open(&self) -> bool + { + if let Self::Open(_) = self { + true + } else { + false + } + } +}