aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-20 19:58:28 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-20 19:58:28 +0100
commit0694f95bfac3be74c33605f947d324890d843c0e (patch)
tree9d9b942bd4c7d549f18f03e5205de47ef70721b2
parente7beb173b8cb83e9a6cfdf02cc2a61bfc7761ba3 (diff)
downloadmail-0694f95bfac3be74c33605f947d324890d843c0e.tar.gz
resurrect
-rw-r--r--Cargo.toml8
-rw-r--r--src/database.rs2
-rw-r--r--src/error.rs16
-rw-r--r--src/ffi.rs10
-rw-r--r--src/lib.rs7
5 files changed, 25 insertions, 18 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 416db6c..a67079f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,9 @@
[package]
-
name = "notmuch"
version = "0.0.1"
-authors = ["C. Morgan Hamill <me@cmhamill.org>"]
+authors = ["C. Morgan Hamill <me@cmhamill.org>",
+ "Dirk Van Haerenborgh <vhdirk@gmail.com>"]
+
+[dependencies]
+notmuch-sys = "*"
+libc = "0.2"
diff --git a/src/database.rs b/src/database.rs
index f1c56c5..ddba507 100644
--- a/src/database.rs
+++ b/src/database.rs
@@ -20,7 +20,7 @@ use ffi;
// Re-exported under database module for pretty namespacin'.
pub use ffi::Mode;
-#[derive(Copy, Debug)]
+#[derive(Copy, Clone, Debug)]
pub struct Version(libc::c_uint);
pub struct Database(*mut ffi::notmuch_database_t);
diff --git a/src/error.rs b/src/error.rs
index 069ae93..046e17f 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,3 +1,4 @@
+use std;
use std::{
error,
fmt,
@@ -5,6 +6,7 @@ use std::{
result,
};
+use ffi_sys;
use ffi;
pub type Result<T> = result::Result<T, Error>;
@@ -21,7 +23,7 @@ impl fmt::Display for Error {
}
}
-impl error::Error for Error {
+impl std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::IoError(ref e) => error::Error::description(e),
@@ -37,20 +39,20 @@ impl error::Error for Error {
}
}
-impl error::FromError<io::Error> for Error {
- fn from_error(err: io::Error) -> Error {
+impl std::convert::From<io::Error> for Error {
+ fn from(err: io::Error) -> Error {
Error::IoError(err)
}
}
-impl error::FromError<ffi::Status> for Error {
- fn from_error(err: ffi::Status) -> Error {
+impl std::convert::From<ffi::Status> for Error {
+ fn from(err: ffi::Status) -> Error {
Error::NotmuchError(err)
}
}
-impl error::FromError<ffi::notmuch_status_t> for Error {
- fn from_error(err: ffi::notmuch_status_t) -> Error {
+impl std::convert::From<ffi::notmuch_status_t> for Error {
+ fn from(err: ffi::notmuch_status_t) -> Error {
Error::NotmuchError(ffi::Status::from(err))
}
}
diff --git a/src/ffi.rs b/src/ffi.rs
index da862d8..6d2ceeb 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -27,7 +27,7 @@ pub type notmuch_compact_status_cb_t = extern fn(*const c_char, *mut c_void);
notmuch_enum! {
#[repr(C)]
- #[derive(Copy, Debug)]
+ #[derive(Copy, Clone, Debug)]
pub enum notmuch_status_t => Status {
NOTMUCH_STATUS_SUCCESS => Success,
NOTMUCH_STATUS_OUT_OF_MEMORY => OutOfMemory,
@@ -86,7 +86,7 @@ impl error::Error for Status {
notmuch_enum! {
#[repr(C)]
- #[derive(Copy, Debug)]
+ #[derive(Copy, Clone, Debug)]
pub enum notmuch_database_mode_t => Mode {
NOTMUCH_DATABASE_MODE_READ_ONLY => ReadOnly,
NOTMUCH_DATABASE_MODE_READ_WRITE => ReadWrite
@@ -95,7 +95,7 @@ notmuch_enum! {
notmuch_enum! {
#[repr(C)]
- #[derive(Copy, Debug)]
+ #[derive(Copy, Clone, Debug)]
pub enum notmuch_sort_t => Sort {
NOTMUCH_SORT_OLDEST_FIRST => OldestFirst,
NOTMUCH_SORT_NEWEST_FIRST => NewestFirst,
@@ -106,7 +106,7 @@ notmuch_enum! {
notmuch_enum! {
#[repr(C)]
- #[derive(Copy, Debug)]
+ #[derive(Copy, Clone, Debug)]
pub enum notmuch_exclude_t => Exclude {
NOTMUCH_EXCLUDE_FLAG => Flag,
NOTMUCH_EXCLUDE_TRUE => True,
@@ -117,7 +117,7 @@ notmuch_enum! {
notmuch_enum! {
#[repr(C)]
- #[derive(Copy, Debug)]
+ #[derive(Copy, Clone, Debug)]
pub enum notmuch_message_flag_t => MessageFlag {
NOTMUCH_MESSAGE_FLAG_MATCH => Match,
NOTMUCH_MESSAGE_FLAG_EXCLUDED => Excluded,
diff --git a/src/lib.rs b/src/lib.rs
index aa21751..63d190f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,11 +1,12 @@
-#![feature(convert, core, libc, unsafe_destructor)]
-extern crate libc;
#[macro_use]
mod macros;
-mod ffi;
+extern crate notmuch_sys as ffi_sys;
+extern crate libc;
+
mod utils;
+mod ffi;
pub mod error;
pub mod database;