diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-20 19:58:28 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-20 19:58:28 +0100 |
| commit | 0694f95bfac3be74c33605f947d324890d843c0e (patch) | |
| tree | 9d9b942bd4c7d549f18f03e5205de47ef70721b2 | |
| parent | e7beb173b8cb83e9a6cfdf02cc2a61bfc7761ba3 (diff) | |
| download | mail-0694f95bfac3be74c33605f947d324890d843c0e.tar.gz | |
resurrect
| -rw-r--r-- | Cargo.toml | 8 | ||||
| -rw-r--r-- | src/database.rs | 2 | ||||
| -rw-r--r-- | src/error.rs | 16 | ||||
| -rw-r--r-- | src/ffi.rs | 10 | ||||
| -rw-r--r-- | src/lib.rs | 7 |
5 files changed, 25 insertions, 18 deletions
@@ -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)) } } @@ -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, @@ -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; |
