aboutsummaryrefslogtreecommitdiffstats
path: root/src/query.rs
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-11-12 21:05:36 +0100
committerGitHub <noreply@github.com>2018-11-12 21:05:36 +0100
commitad70f33648245764c2d02bde14207f9b86bfe016 (patch)
treebef4b10c329d66fde11e4eea8b1300fd7cb2385a /src/query.rs
parent9dad03a829708985a8ff9428c176decd1679ca51 (diff)
parentba03b994b3318c84923f4a9a23cfc4270a5ace75 (diff)
downloadmail-ad70f33648245764c2d02bde14207f9b86bfe016.tar.gz
Merge pull request #10 from eaon/master
Switch to more legible `where` syntax
Diffstat (limited to 'src/query.rs')
-rw-r--r--src/query.rs35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/query.rs b/src/query.rs
index 95a4d56..c73d4ca 100644
--- a/src/query.rs
+++ b/src/query.rs
@@ -33,27 +33,30 @@ impl<'d> ThreadsOwner for Query<'d> {}
impl<'d> MessagesOwner for Query<'d> {}
impl<'d> Query<'d> {
- pub(crate) fn from_ptr<O: Into<Phantomcow<'d, Database>>>(
- ptr: *mut ffi::notmuch_query_t,
- owner: O,
- ) -> Query<'d> {
+ pub(crate) fn from_ptr<O>(ptr: *mut ffi::notmuch_query_t, owner: O) -> Query<'d>
+ where
+ O: Into<Phantomcow<'d, Database>>,
+ {
Query {
handle: QueryPtr { ptr },
marker: owner.into(),
}
}
- pub(crate) fn from_handle<O: Into<Phantomcow<'d, Database>>>(
- handle: QueryPtr,
- owner: O,
- ) -> Query<'d> {
+ pub(crate) fn from_handle<O>(handle: QueryPtr, owner: O) -> Query<'d>
+ where
+ O: Into<Phantomcow<'d, Database>>,
+ {
Query {
handle,
marker: owner.into(),
}
}
- pub fn create<D: Into<Supercow<'d, Database>>>(db: D, query_string: &str) -> Result<Self> {
+ pub fn create<D>(db: D, query_string: &str) -> Result<Self>
+ where
+ D: Into<Supercow<'d, Database>>,
+ {
let dbref = db.into();
dbref
.handle
@@ -97,9 +100,10 @@ impl<'d> Query<'d> {
}
pub trait QueryExt<'d> {
- fn search_threads<'q, Q: Into<Supercow<'q, Query<'d>>>>(
- query: Q,
- ) -> Result<Threads<'q, Query<'d>>> {
+ fn search_threads<'q, Q>(query: Q) -> Result<Threads<'q, Query<'d>>>
+ where
+ Q: Into<Supercow<'q, Query<'d>>>,
+ {
let queryref = query.into();
let mut thrds = ptr::null_mut();
@@ -111,9 +115,10 @@ pub trait QueryExt<'d> {
Ok(Threads::from_ptr(thrds, Supercow::phantom(queryref)))
}
- fn search_messages<'q, Q: Into<Supercow<'q, Query<'d>>>>(
- query: Q,
- ) -> Result<Messages<'q, Query<'d>>> {
+ fn search_messages<'q, Q>(query: Q) -> Result<Messages<'q, Query<'d>>>
+ where
+ Q: Into<Supercow<'q, Query<'d>>>,
+ {
let queryref = query.into();
let mut msgs = ptr::null_mut();