about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-08-29 15:21:05 +0200
committerblake2-ppc <blake2-ppc>2013-08-29 15:51:39 +0200
commitb656bfaaa96dd8d242e6045e7e38b355992aca31 (patch)
tree7ef98fddff583e4242363955a3b945c6ff074245 /src/rustllvm/RustWrapper.cpp
parent518bd073b4b41a5cca0892c1a7878a7b16836db1 (diff)
downloadrust-b656bfaaa96dd8d242e6045e7e38b355992aca31.tar.gz
rust-b656bfaaa96dd8d242e6045e7e38b355992aca31.zip
std::str: Remove functions count_chars, count_bytes
These are very easy to replace with methods on string slices, basically
`.char_len()` and `.len()`.

These are the replacement implementations I did to clean these
functions up, but seeing this I propose removal:

/// ...
pub fn count_chars(s: &str, begin: uint, end: uint) -> uint {
    // .slice() checks the char boundaries
    s.slice(begin, end).char_len()
}

/// Counts the number of bytes taken by the first `n` chars in `s`
/// starting from byte index `begin`.
///
/// Fails if there are less than `n` chars past `begin`
pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint {
    s.slice_from(begin).slice_chars(0, n).len()
}
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions