Brendan Zabarauskas
957fcb3f54
Add some missing Show implementations in libstd
2014-02-13 12:54:01 -08:00
Niko Matsakis
e3ca1c2fca
str -- borrow fields of self for use in closure since self.iter is borrowed
2014-02-11 16:55:24 -05:00
Kevin Ballard
086c0dd33f
Delete send_str, rewrite clients on top of MaybeOwned<'static>
...
Declare a `type SendStr = MaybeOwned<'static>` to ease readibility of
types that needed the old SendStr behavior.
Implement all the traits for MaybeOwned that SendStr used to implement.
2014-02-07 22:31:52 -08:00
Kevin Ballard
28467f5d19
Tweak from_utf8_lossy to return a new MaybeOwned enum
...
MaybeOwned allows from_utf8_lossy to avoid allocation if there are no
invalid bytes in the input.
2014-02-07 22:31:51 -08:00
Kevin Ballard
b0b89a57d5
Add new function str::from_utf8_lossy()
...
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-06 23:44:26 -08:00
bors
cdc678945f
auto merge of #11951 : dmanescu/rust/reserve-rename, r=huonw
...
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949
2014-02-04 04:31:34 -08:00
David Manescu
65f3578148
Rename reserve to reserve_exact and reserve_at_least to reserve
...
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949
2014-02-04 12:33:41 +11:00
Patrick Walton
c594e675eb
librustc: Remove @str
from the language
2014-02-02 01:44:50 +11:00
Patrick Walton
449a7a817f
libextra: Remove @str
from all the libraries
2014-02-02 01:44:50 +11:00
bors
1d494198bb
auto merge of #11930 : bjz/rust/next_power_of_two, r=huonw
2014-02-01 04:11:21 -08:00
Virgile Andreani
b9a026afba
Fix minor doc typos
2014-01-31 21:43:07 -08:00
Brendan Zabarauskas
4109caffc3
Remove some unused imports
2014-02-01 13:03:01 +11:00
Brendan Zabarauskas
9a3583f06d
Make next_power_of_two generic for unsigned integers
...
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-02-01 13:02:53 +11:00
Virgile Andreani
2d60691eb7
Rename CopyableTuple to CloneableTuple
2014-01-28 23:51:52 +01:00
Virgile Andreani
8642601551
Rename OwnedCopyableVector to OwnedCloneableVector
2014-01-28 23:51:52 +01:00
Huon Wilson
0aef487a5c
std,extra: Make some types public and other private.
...
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-26 13:33:05 +11:00
Sean Chalmers
292ed3e55c
Update flip() to be rev().
...
Consensus leaned in favour of using rev instead of flip.
2014-01-23 22:18:18 +01:00
Sean Chalmers
55d6e0e1b7
Rename Invert to Flip - Issue 10632
...
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-23 21:50:18 +01:00
Simon Sapin
ec422d70c3
[std::str] Remove the now unused not_utf8 condition.
2014-01-21 15:48:48 -08:00
Simon Sapin
05ae134ace
[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior
2014-01-21 15:48:48 -08:00
Simon Sapin
b8c4149293
[std::str] Rename from_utf8_opt() to from_utf8(), drop the old from_utf8() behavior
2014-01-21 15:48:48 -08:00
Simon Sapin
b5e65731c0
[std::vec] Rename .shift_opt() to .shift(), drop the old .shift() behavior
2014-01-21 15:48:47 -08:00
Simon Sapin
add8f9680e
[std::vec] Rename .head_opt() to .head(), drop the old .head() behavior
2014-01-21 11:45:08 -08:00
Huon Wilson
39713b8295
Remove unnecessary parentheses.
2014-01-21 22:00:18 +11:00
Palmer Cox
3fd8c8b330
Rename iterators for consistency
...
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-18 01:15:15 -05:00
Brendan Zabarauskas
4fc0452ace
Remove re-exports of std::io::stdio::{print, println} in the prelude.
...
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-11 10:46:00 +11:00
Alex Crichton
bcb1c381a3
stdtest: Fix all leaked trait imports
2014-01-07 23:51:38 -08:00
Alex Crichton
7e0443d6c4
std: Fill in all missing imports
...
Fallout from the previous commits
2014-01-07 23:51:38 -08:00
bors
bc395bc71e
auto merge of #11329 : fhahn/rust/unused-cast-lint2, r=alexcrichton
...
Updates as mentioned in #11135
2014-01-07 01:51:39 -08:00
bors
400070ae55
auto merge of #10826 : SimonSapin/rust/str-insert, r=brson
...
I could not run the tests because of unrelated building issue, sorry about that.
2014-01-06 13:11:38 -08:00
Florian Hahn
8236550104
Remove some unnecessary type casts
...
Conflicts:
src/librustc/middle/lint.rs
2014-01-06 21:28:54 +01:00
Brian Anderson
3b1862a82f
Don't allow newtype structs to be dereferenced. #6246
2014-01-04 14:44:12 -08:00
Simon Sapin
80d0f60d29
Add .insert() and .insert_char() methods to ~str.
2013-12-31 11:20:40 +01:00
Alan Andrade
ff801d662e
Fix tests
2013-12-31 00:51:11 -06:00
Luca Bruno
a9a7a427a1
std: uniform modules titles for doc
...
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-27 09:49:11 +01:00
Alex Crichton
9f1739a8e1
std: Fix all code examples
2013-12-23 09:10:36 -08:00
Huon Wilson
c00104f36a
std: silence warnings when compiling test.
2013-12-20 01:26:03 +11:00
bors
b3cee62034
auto merge of #11065 : huonw/rust/slice-chars-example, r=cmr
2013-12-19 02:36:34 -08:00
Huon Wilson
cacf58caff
std::str: fix .slice_chars example. Fixes #11014 .
2013-12-19 17:36:44 +11:00
Huon Wilson
b906a8b256
std::str: remove .as_mut_buf & rewrite/simplify .push_char
.
...
`.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-19 10:18:02 +11:00
Huon Wilson
17ac2aa523
std::str: replace .as_imm_buf with .as_ptr.
2013-12-19 10:18:02 +11:00
Huon Wilson
9177f7ecb4
std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.
2013-12-19 10:18:02 +11:00
Huon Wilson
4c79b22ef2
std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.
...
There's no need for the restrictions of a closure with the above methods.
2013-12-19 09:26:13 +11:00
bors
8d52dfbace
auto merge of #10984 : huonw/rust/clean-raw, r=cmr
...
See commits for details.
2013-12-15 06:56:27 -08:00
Huon Wilson
164f7a290e
std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].
2013-12-15 23:37:41 +11:00
Huon Wilson
f53292f7ee
Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.
2013-12-15 23:05:30 +11:00
Huon Wilson
55534100ce
std: fix spelling in docs.
2013-12-15 16:26:09 +11:00
Erik Price
5731ca3078
Make 'self lifetime illegal.
...
Also remove all instances of 'self within the codebase.
This fixes #10889 .
2013-12-11 10:54:06 -08:00
Huon Wilson
c629b1d9de
std::str: Add examples to the StrSlice trait.
...
Fixes #10819 .
2013-12-07 13:59:36 +11:00
Huon Wilson
b0426edc0a
std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.
2013-12-04 22:35:53 +11:00