File tree Expand file tree Collapse file tree 4 files changed +170
-274
lines changed Expand file tree Collapse file tree 4 files changed +170
-274
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3
- refs/heads/snap-stage3: 808b4112444932f97b997ea0c9baedf4c5edb7c5
3
+ refs/heads/snap-stage3: 84254948c2e7eee3869e132453d7b870639890f3
4
4
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
5
5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
6
6
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ These can nest arbitrarily:
34
34
As for how to enable or disable these switches, if you’re using Cargo,
35
35
they get set in the [ ` [features] ` section] [ features ] of your ` Cargo.toml ` :
36
36
37
- [ features ] : http://doc.crates.io/manifest.html#the-[features] -section
37
+ [ features ] : http://doc.crates.io/manifest.html#the-%5Bfeatures%5D -section
38
38
39
39
``` toml
40
40
[features ]
Original file line number Diff line number Diff line change @@ -436,23 +436,29 @@ pub mod reader {
436
436
}
437
437
}
438
438
439
- pub fn tagged_docs < F > ( d : Doc , tg : usize , mut it : F ) -> bool where
440
- F : FnMut ( Doc ) -> bool ,
441
- {
442
- let mut pos = d. start ;
443
- while pos < d. end {
444
- let elt_tag = try_or ! ( tag_at( d. data, pos) , false ) ;
445
- let elt_size = try_or ! ( tag_len_at( d. data, elt_tag) , false ) ;
446
- pos = elt_size. next + elt_size. val ;
447
- if elt_tag. val == tg {
448
- let doc = Doc { data : d. data , start : elt_size. next ,
449
- end : pos } ;
450
- if !it ( doc) {
451
- return false ;
439
+ pub fn tagged_docs < ' a > ( d : Doc < ' a > , tag : usize ) -> TaggedDocsIterator < ' a > {
440
+ TaggedDocsIterator {
441
+ iter : docs ( d) ,
442
+ tag : tag,
443
+ }
444
+ }
445
+
446
+ pub struct TaggedDocsIterator < ' a > {
447
+ iter : DocsIterator < ' a > ,
448
+ tag : usize ,
449
+ }
450
+
451
+ impl < ' a > Iterator for TaggedDocsIterator < ' a > {
452
+ type Item = Doc < ' a > ;
453
+
454
+ fn next ( & mut self ) -> Option < Doc < ' a > > {
455
+ while let Some ( ( tag, doc) ) = self . iter . next ( ) {
456
+ if tag == self . tag {
457
+ return Some ( doc) ;
452
458
}
453
459
}
460
+ None
454
461
}
455
- return true ;
456
462
}
457
463
458
464
pub fn with_doc_data < T , F > ( d : Doc , f : F ) -> T where
You can’t perform that action at this time.
0 commit comments