1
Fork 0

std: replace the str::each* fns/methods with byte iterators

This commit is contained in:
Huon Wilson 2013-06-09 00:38:58 +10:00
parent 4b806b4d06
commit 00f5916809
6 changed files with 79 additions and 161 deletions

View file

@ -15,6 +15,7 @@ use str;
use str::StrSlice;
use cast;
use old_iter::BaseIter;
use iterator::IteratorUtil;
use vec::{CopyableVector, ImmutableVector, OwnedVector};
/// Datatype to hold one ascii character. It is 8 bit long.
@ -101,10 +102,7 @@ impl<'self> AsciiCast<&'self[Ascii]> for &'self str {
#[inline(always)]
fn is_ascii(&self) -> bool {
for self.each |b| {
if !b.is_ascii() { return false; }
}
true
self.bytes_iter().all(|b| b.is_ascii())
}
}