aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/message.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/message.rs b/src/message.rs
index bf46a4e..b2b466f 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -1,5 +1,6 @@
use std::ffi::CString;
use std::path::PathBuf;
+use std::cell::RefCell;
use supercow::{Supercow};
use error::{Error, Result};
@@ -24,7 +25,7 @@ where
O: MessageOwner + 'o,
{
pub(crate) handle: MessagePtr,
- marker: ScopedPhantomcow<'o, O>,
+ marker: RefCell<ScopedPhantomcow<'o, O>>,
}
impl<'o, O> MessageOwner for Message<'o, O> where O: MessageOwner + 'o {}
@@ -41,7 +42,7 @@ where
{
Message {
handle: MessagePtr { ptr },
- marker: owner.into(),
+ marker: RefCell::new(owner.into()),
}
}
@@ -55,10 +56,11 @@ where
tid.to_str().unwrap().to_string()
}
- pub fn replies(self: &mut Self) -> Messages<'o, O> {
+ pub fn replies(self: &Self) -> Messages<'o, O> {
Messages::<'o, O>::from_ptr(
unsafe { ffi::notmuch_message_get_replies(self.handle.ptr) },
- ScopedPhantomcow::<'o, O>::share(&mut self.marker)
+ // will never panic since the borrow is released immediately
+ ScopedPhantomcow::<'o, O>::share(&mut *(self.marker.borrow_mut()))
)
}