Skip to content

Commit e360ddb

Browse files
committed
core: Add iterable implementation for strings
1 parent 092c244 commit e360ddb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libcore/iter.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ impl<A> of iterable<A> for option<A> {
3333
}
3434
}
3535

36+
impl of iterable<char> for str {
37+
fn iter(blk: fn(&&char)) {
38+
str::chars_iter(self) { |ch| blk(ch) }
39+
}
40+
}
41+
3642
fn enumerate<A,IA:iterable<A>>(self: IA, blk: fn(uint, A)) {
3743
let i = 0u;
3844
self.iter {|a|

0 commit comments

Comments
 (0)