implement rfc 1054: split_whitespace() fn, deprecate words()

For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.

Also cleaned up references to s.words() throughout codebase.

Closes #15628
This commit is contained in:
kwantam 2015-04-18 13:49:51 -04:00
parent f43c86cda4
commit c361e13d71
11 changed files with 53 additions and 28 deletions

View file

@ -9,11 +9,9 @@
// except according to those terms.
#![feature(str_words)]
fn main() {
let foo = "hello".to_string();
let foo: Vec<&str> = foo.words().collect();
let foo: Vec<&str> = foo.split_whitespace().collect();
let invalid_string = &foo[0];
assert_eq!(*invalid_string, "hello");
}