use std::ffi::CString;
use std::ops::Drop;
use std::path::PathBuf;
use supercow::{Phantomcow, Supercow};
use crate::error::{Error, Result};
use crate::ffi;
use crate::utils::ToStr;
use crate::Filenames;
use crate::FilenamesOwner;
use crate::Messages;
use crate::MessagesOwner;
use crate::Tags;
use crate::TagsOwner;
pub trait MessageOwner {}
#[derive(Debug)]
pub(crate) struct MessagePtr {
pub ptr: *mut ffi::notmuch_message_t,
}
impl Drop for MessagePtr {
fn drop(&mut self) {
unsafe { ffi::notmuch_message_destroy(self.ptr) };
}
}
#[derive(Debug)]
pub struct Message<'o, O>
where
O: MessageOwner,
{
pub(crate) handle: MessagePtr,
marker: Phantomcow<'o, O>,
}
impl<'o, O> MessagesOwner for Message<'o, O> where O: MessageOwner + 'o {}
impl<'o, O> FilenamesOwner for Message<'o, O> where O: MessageOwner + 'o {}
impl<'o, O> TagsOwner for Message<'o, O> where O: MessageOwner + 'o {}
impl<'o, O> Message<'o, O>
where
O: MessageOwner + 'o,
{
pub fn from_ptr