Skip to content

Commit 22d0592

Browse files
committed
---
yaml --- r: 211450 b: refs/heads/tmp c: 8425494 h: refs/heads/master v: v3
1 parent 010af32 commit 22d0592

File tree

4 files changed

+170
-274
lines changed

4 files changed

+170
-274
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 2d00dc3b85aaf81caa3a4e5764c5e185a4dd0a7c
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 808b4112444932f97b997ea0c9baedf4c5edb7c5
35+
refs/heads/tmp: 84254948c2e7eee3869e132453d7b870639890f3
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: 704c2ee730d2e948d11a2edd77e3f35de8329a6e
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/doc/trpl/conditional-compilation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These can nest arbitrarily:
3434
As for how to enable or disable these switches, if you’re using Cargo,
3535
they get set in the [`[features]` section][features] of your `Cargo.toml`:
3636

37-
[features]: http://doc.crates.io/manifest.html#the-[features]-section
37+
[features]: http://doc.crates.io/manifest.html#the-%5Bfeatures%5D-section
3838

3939
```toml
4040
[features]

branches/tmp/src/librbml/lib.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,23 +436,29 @@ pub mod reader {
436436
}
437437
}
438438

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);
452458
}
453459
}
460+
None
454461
}
455-
return true;
456462
}
457463

458464
pub fn with_doc_data<T, F>(d: Doc, f: F) -> T where

0 commit comments

Comments
 (0)