Skip to content

Commit

Permalink
Merge pull request #31 from gauteh/pub-revision
Browse files Browse the repository at this point in the history
db: pub Revision
  • Loading branch information
vhdirk authored Oct 16, 2021
2 parents 50d3d52 + 69d73e9 commit 73977bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
24 changes: 10 additions & 14 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ pub enum Error {

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", error::Error::description(self))
}
}

impl std::error::Error for Error {
fn description(&self) -> &str {
match self {
Error::IoError(e) => error::Error::description(e),
Error::NotmuchError(e) => e.description(),
Error::UnspecifiedError => "Generic notmuch error",
Error::IoError(e) => e.fmt(f),
Error::NotmuchError(e) => e.fmt(f),
Error::UnspecifiedError => write!(f, "Generic notmuch error"),
}
}
}

fn cause(&self) -> Option<&dyn error::Error> {
match *self {
Error::IoError(ref e) => Some(e),
Error::NotmuchError(ref e) => Some(e),
Error::UnspecifiedError => None,
impl error::Error for Error {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match &self {
Error::IoError(e) => Some(e),
Error::NotmuchError(e) => Some(e),
Error::UnspecifiedError => None
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ extern "C" {
///
/// Typical usage might be:
///
/// ```norun
/// ```ignore
/// notmuch_query_t *query;
/// notmuch_threads_t *threads;
/// notmuch_thread_t *thread;
Expand Down Expand Up @@ -744,7 +744,7 @@ extern "C" {
///
/// Typical usage might be:
///
/// ```norun
/// ```ignore
/// notmuch_query_t *query;
/// notmuch_messages_t *messages;
/// notmuch_message_t *message;
Expand Down Expand Up @@ -976,7 +976,7 @@ extern "C" {
///
/// Typical usage might be:
///
/// ```norun
/// ```ignore
/// notmuch_thread_t *thread;
/// notmuch_tags_t *tags;
/// const char *tag;
Expand Down Expand Up @@ -1143,7 +1143,7 @@ extern "C" {
message: *mut notmuch_message_t,
indexopts: *mut notmuch_indexopts_t
) -> notmuch_status_t;

/// Get a value of a flag for the email corresponding to 'message'.
pub fn notmuch_message_get_flag(
message: *mut notmuch_message_t,
Expand Down Expand Up @@ -1192,7 +1192,7 @@ extern "C" {
///
/// Typical usage might be:
///
/// ```norun
/// ```ignore
/// notmuch_message_t *message;
/// notmuch_tags_t *tags;
/// const char *tag;
Expand Down Expand Up @@ -1262,7 +1262,7 @@ extern "C" {
/// This function examines the filenames of 'message' for maildir flags, and adds or removes
/// tags on 'message' as follows when these flags are present:
///
/// ```norun
/// ```ignore
/// Flag Action if present
/// ---- -----------------
/// 'D' Adds the "draft" tag to the message
Expand Down Expand Up @@ -1343,7 +1343,7 @@ extern "C" {
/// change tag values. For example, explicitly setting a message to
/// have a given set of tags might look like this:
///
/// ```norun
/// ```ignore
/// notmuch_message_freeze (message);
///
/// notmuch_message_remove_all_tags (message);
Expand Down Expand Up @@ -1494,7 +1494,7 @@ extern "C" {
///
/// Typical usage might be:
///
/// ```norun
/// ```ignore
/// notmuch_message_properties_t *list;
///
/// for (list = notmuch_message_get_properties (message, "testkey1", TRUE);
Expand Down Expand Up @@ -1818,19 +1818,19 @@ extern "C" {
pub fn notmuch_database_get_default_indexopts(db: *mut notmuch_database_t) -> *mut notmuch_indexopts_t;


////
////
//// Stating a policy about how to decrypt messages.
////
//// See index.decrypt in notmuch-config(1) for more details.
////
////
//// typedef enum {
//// NOTMUCH_DECRYPT_FALSE,
//// NOTMUCH_DECRYPT_TRUE,
//// NOTMUCH_DECRYPT_AUTO,
//// NOTMUCH_DECRYPT_NOSTASH,
//// } notmuch_decryption_policy_t;
////
////
////
//// Specify whether to decrypt encrypted parts while indexing.
////
//// Be aware that the index is likely sufficient to reconstruct the
Expand All @@ -1844,13 +1844,13 @@ extern "C" {

//// Return whether to decrypt encrypted parts while indexing.
//// see notmuch_indexopts_set_decrypt_policy.
////
////
//// @since libnotmuch 5.1 (notmuch 0.26)
pub fn notmuch_indexopts_get_decrypt_policy(options: *const notmuch_indexopts_t) -> notmuch_decryption_policy_t;


/// Destroy a notmuch_indexopts_t object.
///
///
/// @since libnotmuch 5.1 (notmuch 0.26)
pub fn notmuch_indexopts_destroy(options: *mut notmuch_indexopts_t);

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod index;
mod config_list;
mod message_properties;

pub use database::{Database, DatabaseExt, AtomicOperation};
pub use database::{Database, DatabaseExt, AtomicOperation, Revision};
pub use directory::{Directory, DirectoryExt};
pub use error::Error;
pub use filenames::{Filenames, FilenamesOwner};
Expand All @@ -40,4 +40,4 @@ pub use config_list::ConfigList;

pub use ffi::{Status, DatabaseMode, Sort, DecryptionPolicy};

pub use utils::{ScopedSupercow, ScopedPhantomcow};
pub use utils::{ScopedSupercow, ScopedPhantomcow};

0 comments on commit 73977bc

Please sign in to comment.