about summary refs log tree commit diff
path: root/src/libstd/str.rs
AgeCommit message (Collapse)AuthorLines
2014-02-06Add new function str::from_utf8_lossy()Kevin Ballard-6/+179
from_utf8_lossy() takes a byte vector and produces a ~str, converting any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER. The replacement follows the guidelines in §5.22 Best Practice for U+FFFD Substitution from the Unicode Standard (Version 6.2)[1], which also matches the WHATWG rules for utf-8 decoding[2]. [1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf [2]: http://encoding.spec.whatwg.org/#utf-8
2014-02-04auto merge of #11951 : dmanescu/rust/reserve-rename, r=huonwbors-21/+15
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}. Fixes #11949
2014-02-04Rename reserve to reserve_exact and reserve_at_least to reserveDavid Manescu-21/+15
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}. Fixes #11949
2014-02-02librustc: Remove `@str` from the languagePatrick Walton-1/+0
2014-02-02libextra: Remove `@str` from all the librariesPatrick Walton-119/+11
2014-02-01auto merge of #11930 : bjz/rust/next_power_of_two, r=huonwbors-3/+2
2014-01-31Fix minor doc typosVirgile Andreani-2/+2
2014-02-01Remove some unused importsBrendan Zabarauskas-1/+0
2014-02-01Make next_power_of_two generic for unsigned integersBrendan Zabarauskas-2/+2
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-01-28Rename CopyableTuple to CloneableTupleVirgile Andreani-1/+1
2014-01-28Rename OwnedCopyableVector to OwnedCloneableVectorVirgile Andreani-1/+1
2014-01-26std,extra: Make some types public and other private.Huon Wilson-1/+1
These are either returned from public functions, and really should appear in the documentation, but don't since they're private, or are implementation details that are currently public.
2014-01-23Update flip() to be rev().Sean Chalmers-12/+12
Consensus leaned in favour of using rev instead of flip.
2014-01-23Rename Invert to Flip - Issue 10632Sean Chalmers-12/+12
Renamed the invert() function in iter.rs to flip(). Also renamed the Invert<T> type to Flip<T>. Some related code comments changed. Documentation that I could find has been updated, and all the instances I could locate where the function/type were called have been updated as well.
2014-01-21[std::str] Remove the now unused not_utf8 condition.Simon Sapin-8/+0
2014-01-21[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old ↵Simon Sapin-30/+4
from_utf8_owned() behavior
2014-01-21[std::str] Rename from_utf8_opt() to from_utf8(), drop the old from_utf8() ↵Simon Sapin-30/+5
behavior
2014-01-21[std::vec] Rename .shift_opt() to .shift(), drop the old .shift() behaviorSimon Sapin-1/+1
2014-01-21[std::vec] Rename .head_opt() to .head(), drop the old .head() behaviorSimon Sapin-1/+1
2014-01-21Remove unnecessary parentheses.Huon Wilson-3/+3
2014-01-18Rename iterators for consistencyPalmer Cox-78/+78
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2014-01-11Remove re-exports of std::io::stdio::{print, println} in the prelude.Brendan Zabarauskas-2/+2
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-5/+2
2014-01-07std: Fill in all missing importsAlex Crichton-4/+8
Fallout from the previous commits
2014-01-07auto merge of #11329 : fhahn/rust/unused-cast-lint2, r=alexcrichtonbors-2/+2
Updates as mentioned in #11135
2014-01-06auto merge of #10826 : SimonSapin/rust/str-insert, r=brsonbors-0/+42
I could not run the tests because of unrelated building issue, sorry about that.
2014-01-06Remove some unnecessary type castsFlorian Hahn-2/+2
Conflicts: src/librustc/middle/lint.rs
2014-01-04Don't allow newtype structs to be dereferenced. #6246Brian Anderson-2/+6
2013-12-31Add .insert() and .insert_char() methods to ~str.Simon Sapin-0/+42
2013-12-31Fix testsAlan Andrade-5/+9
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-23std: Fix all code examplesAlex Crichton-6/+8
2013-12-20std: silence warnings when compiling test.Huon Wilson-1/+0
2013-12-19auto merge of #11065 : huonw/rust/slice-chars-example, r=cmrbors-1/+1
2013-12-19std::str: fix .slice_chars example. Fixes #11014.Huon Wilson-1/+1
2013-12-19std::str: remove .as_mut_buf & rewrite/simplify `.push_char`.Huon Wilson-23/+6
`.as_mut_buf` was used exactly once, in `.push_char` which could be written in a simpler way, using the `&mut ~[u8]` that it already retrieved. In the rare situation when someone really needs `.as_mut_buf`-like functionality (getting a `*mut u8`), they can go via `str::raw::as_owned_vec`.
2013-12-19std::str: replace .as_imm_buf with .as_ptr.Huon Wilson-85/+55
2013-12-19std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.Huon Wilson-3/+4
2013-12-19std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.Huon Wilson-1/+1
There's no need for the restrictions of a closure with the above methods.
2013-12-15auto merge of #10984 : huonw/rust/clean-raw, r=cmrbors-20/+22
See commits for details.
2013-12-15std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].Huon Wilson-2/+2
2013-12-15Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.Huon Wilson-18/+20
2013-12-15std: fix spelling in docs.Huon Wilson-6/+6
2013-12-11Make 'self lifetime illegal.Erik Price-130/+130
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-07std::str: Add examples to the StrSlice trait.Huon Wilson-42/+321
Fixes #10819.
2013-12-04std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.Huon Wilson-15/+15
2013-12-04std::str: remove from_utf8.Huon Wilson-107/+7
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-3/+9
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-106/+62
2013-11-26librustc: Remove remaining uses of `&fn()` in favor of `||`.Patrick Walton-1/+1