| Commit message (Collapse) | Author | Age |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Crate-private utility trait for `new()` methods on types.
|
| |
|
|
| |
No longer necessary with the `From` and `Into` traits from std::convert.
|
| |
|
|
| |
Use `AsRef<Path>` instead of `AsOsStr`.
|
| |
|
|
|
| |
Changes in commit 95d4fba8436417a6c27522ed9b51c19a9fd7c6f9
make the trait unnecessary. The `ToStr` trait is now sufficient.
|
| |
|
|
| |
Turns out to be useful outside of just enums.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If I have this correct:
The output `&str` will have the same lifetime as whatever the lifetime
of the block in which it is called.
This allows using it one the output of notmuch FFI calls, by propogating
the lifetime of the safe wrapper object (e.g., `Database`) to the `&str`
returned from `to_str()`. This mirrors the lifetime of the actual
underlying C string.
If I don't grok lifetimes as well as I think, this could be a lie.
Future self: you should add unit tests to test the above explanation.
|
| |
|
|
|
|
|
|
| |
Allows easy conversion of any `T: AsOsStr` to a `CString`, whose
`as_ptr()` method is quite convenient for FFI calls.
Note that `std::path::Path` implements `AsOsStr`, which means we can
easily take paths and get a pointer to `*const libc::c_char`.
|
| |
|
|
|
|
|
|
| |
Allow easy mapping of borrowed C strings to borrowed strings with
appropriate lifetimes.
I have some doubts about this, as I'm not 100% on how lifetimes interact
with the notmuch-provided strings yet.
|
|
|
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.
|