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 @@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32
32
refs/heads/beta: 2d00dc3b85aaf81caa3a4e5764c5e185a4dd0a7c
33
33
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
34
34
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35
- refs/heads/tmp: 808b4112444932f97b997ea0c9baedf4c5edb7c5
35
+ refs/heads/tmp: 84254948c2e7eee3869e132453d7b870639890f3
36
36
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
37
37
refs/tags/homu-tmp: 704c2ee730d2e948d11a2edd77e3f35de8329a6e
38
38
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412
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