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 @@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: 808b4112444932f97b997ea0c9baedf4c5edb7c5
32
+ refs/heads/stable: 84254948c2e7eee3869e132453d7b870639890f3
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
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