Skip to content

Commit f84770c

Browse files
committed
---
yaml --- r: 225370 b: refs/heads/stable c: 710270d h: refs/heads/master v: v3
1 parent e5336ed commit f84770c

File tree

7 files changed

+304
-177
lines changed

7 files changed

+304
-177
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 2d447e40e29bbb47120dd01b3d25b2510b345284
32+
refs/heads/stable: 710270d9c0b9b9e65e606e1c6109329c93499837
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/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-%5Bfeatures%5D-section
37+
[features]: http://doc.crates.io/manifest.html#the-[features]-section
3838

3939
```toml
4040
[features]

branches/stable/src/librbml/lib.rs

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

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);
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;
458452
}
459453
}
460-
None
461454
}
455+
return true;
462456
}
463457

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

0 commit comments

Comments
 (0)