about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-30 04:40:47 -0700
committerbors <bors@rust-lang.org>2013-08-30 04:40:47 -0700
commit1f9bd62fd6d63689b2d4bb4338625addf0e09bdd (patch)
tree0492bfee0c9883c33243c6a7ad55195f5a83d0f4 /src/rustllvm/RustWrapper.cpp
parent72bf8956298107d36430bbfc4a18177e7b2097c6 (diff)
parentb656bfaaa96dd8d242e6045e7e38b355992aca31 (diff)
downloadrust-1f9bd62fd6d63689b2d4bb4338625addf0e09bdd.tar.gz
rust-1f9bd62fd6d63689b2d4bb4338625addf0e09bdd.zip
auto merge of #8857 : blake2-ppc/rust/std-str-remove, r=thestinger
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