From e97adfec1d98ba8d9b294433f1d4ed970e55d979 Mon Sep 17 00:00:00 2001 From: Avril Date: Tue, 15 Sep 2020 17:43:02 +0100 Subject: [PATCH] fix --- src/ext.rs | 1 + src/state/mod.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) 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 + } + } +}