aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorC. Morgan Hamill <me@cmhamill.org>2015-03-19 16:43:51 +0100
committerC. Morgan Hamill <me@cmhamill.org>2015-03-19 18:59:52 +0100
commitacb67e3d7fef9e83e0be3150d42af3dd02e33fa6 (patch)
treed0114011907d5a137f0c118f9ef44dc1cd692b57 /src/lib.rs
parenta0f345202299b5f5214f1a791e896376e6cb7a04 (diff)
downloadmail-acb67e3d7fef9e83e0be3150d42af3dd02e33fa6.tar.gz
Add `NotmuchEnum` trait and `notmuch_enum!` macro.
Implements enum types in pairs, specifying the type and variant names of each, like so: notmuch_enum! { pub enum enum_name => EnumName { variant_one => VariantOne, variant_two => VariantTwo } } Which expands to: pub enum enum_name { variant_one, variant_two } pub enum EnumName { VariantOne, VariantTwo } The `NotmuchEnum` trait also entails two functions to convert between the defined pairs, `from_notmuch_t()` and `to_notmuch_t()`. The macro takes care of their implementation, also. Yes, this is purely aesthetic whimsy: I wanted the types in the `ffi` module to match the types from the `notmuch.h` file, and I wanted the types I used within (and exported by) this crate to match the expected Rust convention.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5c2fbd6..0f88f60 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,8 @@
#![feature(libc)]
extern crate libc;
+#[macro_use]
+mod macros;
+
mod ffi;
+mod utils;