Skip to content

Commit 82c6a36

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163304 b: refs/heads/snap-stage3 c: 594ff51 h: refs/heads/master v: v3
1 parent c0dd8af commit 82c6a36

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 807c5e8c8d9a6275846e010007119ba64f42f105
4+
refs/heads/snap-stage3: 594ff51b237299565a79de323aa1ba390190e28a
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librbml/lib.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ pub mod reader {
260260
}
261261
}
262262

263-
pub fn docs<'a>(d: Doc<'a>, it: |uint, Doc<'a>| -> bool) -> bool {
263+
pub fn docs<F>(d: Doc, mut it: F) -> bool where
264+
F: FnMut(uint, Doc) -> bool,
265+
{
264266
let mut pos = d.start;
265267
while pos < d.end {
266268
let elt_tag = try_or!(vuint_at(d.data, pos), false);
@@ -274,7 +276,9 @@ pub mod reader {
274276
return true;
275277
}
276278

277-
pub fn tagged_docs<'a>(d: Doc<'a>, tg: uint, it: |Doc<'a>| -> bool) -> bool {
279+
pub fn tagged_docs<F>(d: Doc, tg: uint, mut it: F) -> bool where
280+
F: FnMut(Doc) -> bool,
281+
{
278282
let mut pos = d.start;
279283
while pos < d.end {
280284
let elt_tag = try_or!(vuint_at(d.data, pos), false);
@@ -291,7 +295,9 @@ pub mod reader {
291295
return true;
292296
}
293297

294-
pub fn with_doc_data<'a, T>(d: Doc<'a>, f: |x: &'a [u8]| -> T) -> T {
298+
pub fn with_doc_data<T, F>(d: Doc, f: F) -> T where
299+
F: FnOnce(&[u8]) -> T,
300+
{
295301
f(d.data[d.start..d.end])
296302
}
297303

@@ -399,8 +405,9 @@ pub mod reader {
399405
Ok(r as uint)
400406
}
401407

402-
pub fn read_opaque<R>(&mut self,
403-
op: |&mut Decoder<'doc>, Doc| -> DecodeResult<R>) -> DecodeResult<R> {
408+
pub fn read_opaque<R, F>(&mut self, op: F) -> DecodeResult<R> where
409+
F: FnOnce(&mut Decoder, Doc) -> DecodeResult<R>,
410+
{
404411
let doc = try!(self.next_doc(EsOpaque));
405412

406413
let (old_parent, old_pos) = (self.parent, self.pos);
@@ -761,7 +768,9 @@ pub mod writer {
761768
Ok(r)
762769
}
763770

764-
pub fn wr_tag(&mut self, tag_id: uint, blk: || -> EncodeResult) -> EncodeResult {
771+
pub fn wr_tag<F>(&mut self, tag_id: uint, blk: F) -> EncodeResult where
772+
F: FnOnce() -> EncodeResult,
773+
{
765774
try!(self.start_tag(tag_id));
766775
try!(blk());
767776
self.end_tag()
@@ -857,7 +866,9 @@ pub mod writer {
857866
else { Ok(()) }
858867
}
859868

860-
pub fn emit_opaque(&mut self, f: |&mut Encoder<W>| -> EncodeResult) -> EncodeResult {
869+
pub fn emit_opaque<F>(&mut self, f: F) -> EncodeResult where
870+
F: FnOnce(&mut Encoder<W>) -> EncodeResult,
871+
{
861872
try!(self.start_tag(EsOpaque as uint));
862873
try!(f(self));
863874
self.end_tag()

0 commit comments

Comments
 (0)