aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-12-23 22:14:39 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-12-23 22:14:39 +0100
commita2a415cde2bbf62f2d8351900e0fcd9373cb3d67 (patch)
treeba90f78903f0c91b6b6442f46cd4af969e794a0f
parentceb1ed661f1769efd73bd519c909b4bb59aca488 (diff)
downloadmail-a2a415cde2bbf62f2d8351900e0fcd9373cb3d67.tar.gz
remove streaming iterators from readme
-rw-r--r--README.md29
1 files changed, 10 insertions, 19 deletions
diff --git a/README.md b/README.md
index 8f2e9e8..1fcbddf 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,6 @@ extern crate notmuch;
```rust
extern crate notmuch;
-use notmuch::StreamingIterator;
fn main() {
@@ -42,7 +41,7 @@ fn main() {
let query = db.create_query("").unwrap();
let mut threads = query.search_threads().unwrap();
- while let Some(thread) = threads.next() {
+ for thread in threads {
println!("thread {:?} {:?}", thread.subject(), thread.authors());
}
}
@@ -64,15 +63,16 @@ feel this is too permissive, let me know.
All structs are strictly linked together with their lifetime. The root of the
tree is ```Database```, which has a lifetime that must outlive any child
objects, for instance ```Query```. The ```Threads``` iterator that you can get
-from a ```Query``` is always outlived by the parent query. ```Threads``` in its
-turn must have a longer life than ```Thread```, which in turn must outlive
-```Messages``` and so on. Each structure keeps a ```PhantomData``` marker of its
-owner.
+from a ```Query``` is always outlived by the parent query. The ```Threads```
+does not own any individual ```Thread```. These are bound to the owner of
+the ```Threads``` iterator itself. Each structure keeps a ```PhantomCow```
+marker for its owner.
-Using this in an application poses significant difficulties in satisfying these
-lifetime requirements. To alleviate this, ```notmuch-rs``` makes use of the
-excellent [Supercow](https://crates.io/crates/supercow), so you don't have to
-use crates like ```owningref``` or ```rental``` to get around this.
+Typically, using a lifetimes structure like this in an application poses
+significant difficulties in satisfying these lifetime requirements. While other
+libraries force the application developers towards crates like ```owningref```
+or ```rental``` to get around this, ```notmuch-rs``` makes use of the
+excellent [Supercow](https://crates.io/crates/supercow), to alleviate this.
This way, you get to choose your own container type, and even keep the parent
object alive so you don't have to juggle lifetimes. To use this, most types
@@ -91,15 +91,6 @@ comparable.
```
-## Iterators
-
-Since the lifetime of a ```Thread``` or a ```Message``` is dependent on the
-```Threads``` and ```Messages``` iterator respectively, using the regular rust
-```Iterator``` trait proved impossible. As such, ```notmuch-rs``` includes a
-```StreamingIterator``` (and additional ```StreamingIteratorExt```) trait that
-is used to iterate while satisfying the lifetime constraints.
-
-
## Acknowledgements
notmuch-rs started out from the following projects: