https://github.com/vhdirk/notmuch-rs
Rust interface and bindings for notmuch
https://github.com/vhdirk/notmuch-rs
notmuch rust
Last synced: 11 months ago
JSON representation
Rust interface and bindings for notmuch
- Host: GitHub
- URL: https://github.com/vhdirk/notmuch-rs
- Owner: vhdirk
- License: gpl-3.0
- Created: 2018-03-22T09:42:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-14T09:52:49.000Z (about 1 year ago)
- Last Synced: 2025-06-21T01:53:23.093Z (12 months ago)
- Topics: notmuch, rust
- Language: Rust
- Size: 281 KB
- Stars: 26
- Watchers: 6
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# notmuch-rs
This is not much more than a wrapper for the [notmuch](https://notmuchmail.org/) C api.
[](https://travis-ci.org/vhdirk/notmuch-rs)
[](https://crates.io/crates/notmuch)
[](https://crates.io/crates/notmuch)
[](https://crates.io/crates/notmuch) [](https://gitter.im/notmuch-rs/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Building
**notmuch-rs** expects libnotmuch development files to be installed on your system.
## Using
Add this to your `Cargo.toml`:
```toml
[dependencies]
notmuch = "*"
```
and this to your crate root:
```rust
extern crate notmuch;
```
## Example
```rust
extern crate notmuch;
fn main() {
let mut mail_path = std::env::home_dir().unwrap();
mail_path.push(".mail");
let mut config_path = std::env::home_dir().unwrap();
config_path.push(".config/custom-notmuch-config-path");
let db = notmuch::Database::open_with_config(
&mail_path,
notmuch::DatabaseMode::ReadOnly,
&config_path,
None,
)
.unwrap();
let query = db.create_query("").unwrap();
let mut threads = query.search_threads().unwrap();
for thread in threads {
println!("thread {:?} {:?}", thread.subject(), thread.authors());
}
}
```
## Concurrency
Notmuch makes no claims regarding thread safety. It does not seem to use any
thread locals, but I did not spot any locks. So, as far as I am concerned, it is
not thread safe. Hence, all pointers are internally tracked with `Rc`s.
## Acknowledgements
notmuch-rs started out from the following projects:
- https://github.com/Stebalien/notmuch-sys/blob/master/src/lib.rs
- https://github.com/cmhamill/rust-notmuch
Any contributions are welcome!