summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-08-06Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-683/+831
remove-str-trailing-nulls
2013-08-06std: update str.push_byte to work without str trailing nullsErick Tryzelaar-1/+10
2013-08-06Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into ↵Erick Tryzelaar-670/+114
remove-str-trailing-nulls
2013-08-06auto merge of #8231 : SimonSapin/rust/ascii-upper-lower-case, r=cmrbors-11/+169
Original pull request: Add str.to_ascii_lower() and str.to_ascii_upper() methods in std::str.
2013-08-06iterator: rename `Counter::new` to `count`Daniel Micay-17/+15
to match the convention used by `range`, since `iterator::count` is already namespaced enough and won't be ambiguous
2013-08-06add Extendable to the preludeDaniel Micay-1/+2
2013-08-06iterator: simplify the `take` implementationDaniel Micay-2/+1
2013-08-06Add to_ascii_upper, to_ascii_lower and eq_ignore_ascii_case in std::asciiSimon Sapin-11/+169
2013-08-06auto merge of #8317 : bblum/rust/fast-spawn-unlinked, r=brsonbors-50/+67
This lazily initializes the taskgroup structs for ```spawn_unlinked``` tasks. If such a task never spawns another task linked to it (or a descendant of it), its taskgroup is simply never initialized at all. Also if an unlinked task spawns another unlinked task, neither of them will need to initialize their taskgroups. This works for the main task too. I benchmarked this with the following test case and observed a ~~21% speedup (average over 4 runs: 7.85 sec -> 6.20 sec, 2.5 GHz)~~ 11% speedup, see comment below. ``` use std::task; use std::cell::Cell; use std::rt::comm; static NUM: uint = 1024*256; fn run(f: ~fn()) { let mut t = task::task(); t.unlinked(); t.spawn(f); } fn main() { do NUM.times { let (p,c) = comm::oneshot(); let c = Cell::new(c); do run { c.take().send(()); } p.recv(); } } ```
2013-08-06Use FromStr for IpAddr in rt::uv::netStepan Koltsov-70/+2
2013-08-06auto merge of #8313 : msullivan/rust/cleanup, r=catamorphismbors-1/+1
2013-08-06Implement FromStr for IpAddr and SocketAddrStepan Koltsov-0/+365
Better than that in rt::uv::net, because it: * handles invalid input explicitly, without fail!() * parses socket address, not just IP * handles various ipv4-in-ipv6 addresses, like 2001:db8:122:344::192.0.2.33 (see http://tools.ietf.org/html/rfc6052 for example) * rejects output like `127.0000000.0.1` * does not allocate heap memory * have unit tests
2013-08-06auto merge of #8308 : blake2-ppc/rust/str-slice-bytes, r=alexcrichtonbors-1/+1
`fn slice_bytes` is marked unsafe since it allows violating the valid string encoding property; but the function did also allow extending the lifetime of the slice by mistake, since it's returning `&str`. Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so that all uses of `slice_bytes` are region checked correctly.
2013-08-05Update Iterator impls to use SaturatingKevin Ballard-25/+10
Replace hand-rolled saturation math with calls to Saturating. Fix one impl that didn't use saturating math.
2013-08-05Add std::num::SaturatingKevin Ballard-60/+157
Saturating is an implementation of saturating math operations (at the moment just add and sub) for integral types.
2013-08-05std: c_str should use regions on methodsErick Tryzelaar-3/+3
2013-08-05std: fix a typo where .to_c_str wasn't being called on androidErick Tryzelaar-1/+1
2013-08-06std: Fix bug in ChunkIter::idxblake2-ppc-1/+4
ChunkIter .idx() didn't handle overflow correctly, even though it tried.
2013-08-06std: Remove uint::iterate, replaced by `range`blake2-ppc-28/+3
2013-08-06std: Improve the documentation for iterator::Invertblake2-ppc-0/+11
2013-08-06std: Use method name Option::consumeblake2-ppc-5/+7
With Option as the simplest container, `consume` is the way to turn it into a by-value iterator.
2013-08-06std: Rewrite the HashSet set operation iteratorsblake2-ppc-37/+17
Use the Repeat iterator to carry the "explicit closure capture" that was previously done with the custom EnvFilterIterator.
2013-08-06std: Add iterator::Repeat to repeat an element endlesslyblake2-ppc-0/+33
2013-08-06std: Improve vec::ChunkIterblake2-ppc-8/+51
Implement clone, bidirectionality and random access for this iterator
2013-08-06std: Implement RandomAccessIterator for Invertblake2-ppc-0/+21
2013-08-06std: Remove unused trait bound in Result::mapblake2-ppc-1/+1
2013-08-06std: Convert Result to use external iteratorsblake2-ppc-14/+18
convert iter() and iter_err() for Result. Use OptionIterator.
2013-08-06std: Add .consume_iter() for Option, to make it reusableblake2-ppc-27/+15
Let Option be a base for a widely useful one- or zero- item iterator. Refactor OptionIterator to support any generic element type, so the same iterator impl can be used for both &T, &mut T and T iterators.
2013-08-05auto merge of #8288 : Kimundi/rust/opteitres4, r=brsonbors-516/+493
This is an alternative version to https://github.com/mozilla/rust/pull/8268, where instead of transitioning to `get()` completely, I transitioned to `unwrap()` completely. My reasoning for also opening this PR is that having two different functions with identical behavior on a common datatype is bad for consistency and confusing for users, and should be solved as soon as possible. The fact that apparently half the code uses `get()`, and the other half `unwrap()` only makes it worse. If the final naming decision ends up different, there needs to be a big renaming anyway, but until then it should at least be consistent. --- - Made naming schemes consistent between Option, Result and Either - Lifted the quality of the either and result module to that of option - Changed Options Add implementation to work like the maybe Monad (return None if any of the inputs is None) See https://github.com/mozilla/rust/issues/6002, especially my last comment. - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead See also https://github.com/mozilla/rust/issues/7887. Todo: Adding testcases for all function in the three modules. Even without the few functions I added, the coverage wasn't complete to begin with. But I'd rather do that as a follow up PR, I've touched to much code here already, need to go through them again later.
2013-08-05Lazily initialize 'leaf node' taskgroups for unlinked spawns, for an ↵Ben Blum-45/+63
apparent 11% speedup.
2013-08-05(cleanup) Uncomment an assertion that now holds.Ben Blum-5/+4
2013-08-05auto merge of #8298 : darkf/rust/fix-3948, r=pcwaltonbors-1/+1
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-516/+493
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05Get rid of some NOTEs.Michael Sullivan-1/+1
2013-08-05auto merge of #8293 : dim-an/rust/trie-iterator, r=thestingerbors-0/+94
Closes #5506.
2013-08-05std: Use correct lifetime parameter on str::raw::slice_bytesblake2-ppc-1/+1
fn slice_bytes is marked unsafe since it allows violating the valid string encoding property; but the function did also allow extending the lifetime of the slice by mistake, since it's returning `&str`. Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so that all uses of slice_bytes are region checked correctly.
2013-08-05auto merge of #8289 : sfackler/rust/push_byte, r=ericktbors-1/+8
It was previously pushing the byte on top of the string's null terminator. I added a test to make sure it doesn't break in the future.
2013-08-05auto merge of #8303 : brson/rust/tls-magic-wtf, r=brsonbors-0/+13
2013-08-05std::rt: Use magic to make TLS work from annihilated boxes. #8302Brian Anderson-0/+13
2013-08-04std::rt: Schedule more scheduler callbacks to avoid dropping messagesBrian Anderson-1/+3
2013-08-04std: Fix newsched logging truncationBrian Anderson-14/+17
The truncation needs to be done in the console logger in order to catch all the logging output, and because truncation only matters when outputting to the console.
2013-08-04Open files in binary mode. Closes #3948darkf-1/+1
2013-08-04std: Update the c_str docs, and support CString not owning the pointerErick Tryzelaar-138/+63
2013-08-04auto merge of #8282 : brson/rust/more-newsched-fixes, r=brsonbors-211/+74
2013-08-04auto merge of #8218 : brson/rust/nogc, r=brsonbors-444/+0
These are both obsoleted by the forthcoming new GC.
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-492/+470
2013-08-05Remove debug printing.Dmitry Ermolov-2/+0
2013-08-04Remove trailing null from stringsErick Tryzelaar-25/+439
2013-08-04std: remove use of cast module from os.Erick Tryzelaar-13/+6
2013-08-04std: merge str::raw::from_buf and str::raw::from_c_strErick Tryzelaar-23/+13