diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-12 22:17:10 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-12 22:17:10 -0800 |
| commit | e360ddbd65e2501028f80e17a1ec7ad92904f39c (patch) | |
| tree | fd930dcdc473a5cb525bc4e909e7027d2f87af86 | |
| parent | 092c244d3a8ff32a323e08de9c166144e06233a5 (diff) | |
| download | rust-e360ddbd65e2501028f80e17a1ec7ad92904f39c.tar.gz rust-e360ddbd65e2501028f80e17a1ec7ad92904f39c.zip | |
core: Add iterable implementation for strings
| -rw-r--r-- | src/libcore/iter.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index ea0429cd763..e1f9c4ec548 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -33,6 +33,12 @@ impl<A> of iterable<A> for option<A> { } } +impl of iterable<char> for str { + fn iter(blk: fn(&&char)) { + str::chars_iter(self) { |ch| blk(ch) } + } +} + fn enumerate<A,IA:iterable<A>>(self: IA, blk: fn(uint, A)) { let i = 0u; self.iter {|a| |
