about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2013-08-07Turn OptGroups into a main opt and a main and an aliased optsJordi Boggiano-35/+72
This way opt_present("apple") will match no matter if the user passed -a or --apple
2013-08-07Add missing getopts::groups::optflagmulti functionJordi Boggiano-0/+14
2013-08-07Forbid `priv` where it has no effectAlex Crichton-33/+33
This is everywhere except struct fields and enum variants.
2013-08-07std: Fix for-range loops that can use iteratorsblake2-ppc-34/+21
Fix inappropriate for-range loops to use for-iterator constructs (or other appropriate solution) instead.
2013-08-07extra: Remove all .each methods in smallintmapblake2-ppc-43/+0
2013-08-07auto merge of #8358 : brson/rust/newrt, r=brsonbors-0/+3
2013-08-07Disable linked failure testsBrian Anderson-0/+3
The implementation currently contains a race that leads to segfaults.
2013-08-07auto merge of #8320 : mihneadb/rust/freq_count, r=cmrbors-0/+11
2013-08-07Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-446/+265
remove-str-trailing-nulls
2013-08-07auto merge of #8294 : erickt/rust/map-move, r=bblumbors-23/+23
According to #7887, we've decided to use the syntax of `fn map<U>(f: &fn(&T) -> U) -> U`, which passes a reference to the closure, and to `fn map_move<U>(f: &fn(T) -> U) -> U` which moves the value into the closure. This PR adds these `.map_move()` functions to `Option` and `Result`. In addition, it has these other minor features: * Replaces a couple uses of `option.get()`, `result.get()`, and `result.get_err()` with `option.unwrap()`, `result.unwrap()`, and `result.unwrap_err()`. (See #8268 and #8288 for a more thorough adaptation of this functionality. * Removes `option.take_map()` and `option.take_map_default()`. These two functions can be easily written as `.take().map_move(...)`. * Adds a better error message to `result.unwrap()` and `result.unwrap_err()`.
2013-08-07auto merge of #8326 : thestinger/rust/iterator, r=alexcrichtonbors-332/+1
The `extra::iter` module wasn't actually included in `extra.rs` when it was moved from `std`... I assume no one is going to miss it.
2013-08-07Add frequency count to extra::stat. #8281Mihnea Dobrescu-Balaur-0/+11
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-20/+20
2013-08-07std: add result.map_move, result.map_err_moveErick Tryzelaar-1/+1
2013-08-07option.get -> option.unwrapErick Tryzelaar-2/+2
2013-08-06remove `extra::iter`Daniel Micay-331/+0
This module provided adaptors for the old internal iterator protocol, but they proved to be quite unreadable and are not generic enough to handle borrowed pointers well. Since Rust no longer defines an internal iteration protocol, I don't think there's going to be any reuse via these adaptors.
2013-08-06Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-130/+375
remove-str-trailing-nulls
2013-08-06Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into ↵Erick Tryzelaar-57/+243
remove-str-trailing-nulls
2013-08-06iterator: rename `Counter::new` to `count`Daniel Micay-1/+1
to match the convention used by `range`, since `iterator::count` is already namespaced enough and won't be ambiguous
2013-08-06Result::get -> Result::unwrapSteven Fackler-6/+6
2013-08-06Removed convenience encoding trait implsSteven Fackler-154/+63
Encoding should really only be done from [u8]<->str. The extra convenience implementations don't really have a place, especially since they're so trivial. Also improved error messages in FromBase64.
2013-08-06Removing space for NULL terminatorSteven Fackler-2/+1
String NULL terminators are going away soon, so we may as well get rid of this now so it doesn't rot.
2013-08-06ToBase64 and ToHex perf improvementsSteven Fackler-37/+38
The overhead of str::push_char is high enough to cripple the performance of these two functions. I've switched them to build the output in a ~[u8] and then convert to a string later. Since we know exactly the bytes going into the vector, we can use the unsafe version to avoid the is_utf8 check. I could have riced it further with vec::raw::get, but it only added ~10MB/s so I didn't think it was worth it. ToHex is still ~30% slower than FromHex, which is puzzling. Before: ``` test base64::test::from_base64 ... bench: 1000 ns/iter (+/- 349) = 204 MB/s test base64::test::to_base64 ... bench: 2390 ns/iter (+/- 1130) = 63 MB/s ... test hex::tests::bench_from_hex ... bench: 884 ns/iter (+/- 220) = 341 MB/s test hex::tests::bench_to_hex ... bench: 2453 ns/iter (+/- 919) = 61 MB/s ``` After: ``` test base64::test::from_base64 ... bench: 1271 ns/iter (+/- 600) = 160 MB/s test base64::test::to_base64 ... bench: 759 ns/iter (+/- 286) = 198 MB/s ... test hex::tests::bench_from_hex ... bench: 875 ns/iter (+/- 377) = 345 MB/s test hex::tests::bench_to_hex ... bench: 593 ns/iter (+/- 240) = 254 MB/s ```
2013-08-06Some minor hex changesSteven Fackler-6/+8
2013-08-06Added hexadecimal encoding moduleSteven Fackler-0/+239
FromHex ignores whitespace and parses either upper or lower case hex digits. ToHex outputs lower case hex digits with no whitespace. Unlike ToBase64, ToHex doesn't allow you to configure the output format. I don't feel that it's super useful in this case.
2013-08-06auto merge of #8312 : alexcrichton/rust/use-treemap, r=ericktbors-18/+1
Closes #4430
2013-08-06auto merge of #8054 : sammykim/rust/move-EnumSet, r=alexcrichtonbors-0/+289
Fix #8004
2013-08-06Move EnumSet into libextraSangeun Kim-0/+289
2013-08-06std: Remove uint::iterate, replaced by `range`blake2-ppc-4/+3
2013-08-06extra: Simplify the bitv iterators using Repeatblake2-ppc-44/+19
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-64/+63
- 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-05Use TreeMap's ord implementation for JsonAlex Crichton-18/+1
Closes #4430
2013-08-05auto merge of #8183 : omasanori/rust/migrate-new, r=sanxiynbors-22/+24
It seems that relatively new code uses `Foo::new()` instead of `Foo()` so I wrote a patch to migrate some structs to the former style. Is it a right direction? If there are any guidelines not to use new()-style, could you add them to the [style guide](https://github.com/omasanori/rust/wiki/Note-style-guide)?
2013-08-05auto merge of #8227 : dim-an/rust/tree-iter, r=thestingerbors-5/+147
2013-08-05Add extra::arena::Arena::new{, _with_size}.OGINO Masanori-22/+24
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-04auto merge of #8297 : brson/rust/dlist-dtor, r=brsonbors-4/+38
The compiler-generated dtor for DList recurses deeply to drop Nodes. For big lists this can overflow the stack. This is a problem for the new scheduler, where split stacks are not implemented. Thanks @blake2-ppc
2013-08-04extra: Don't recurse in DList drop glue. #8295Brian Anderson-4/+38
The compiler-generated dtor for DList recurses deeply to drop Nodes. For big lists this can overflow the stack.
2013-08-04auto merge of #8282 : brson/rust/more-newsched-fixes, r=brsonbors-8/+1
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-246/+236
2013-08-04Remove trailing null from stringsErick Tryzelaar-2/+98
2013-08-04Remove old tests and code for `select`Brian Anderson-8/+1
Not compatible with newsched
2013-08-04auto merge of #8260 : omasanori/rust/fix-extra-unicode, r=pcwaltonbors-18/+33
WIth this patch `RUSTFLAGS='--cfg unicode' make check"` passed successfully. * Why doesn't `#[link_name="icuuc"]` make libextra to link against libicuuc.so? * In `extra::unicode::tests`, `use unicode; unicode::is_foo('a')` failed but `use unicode::*; is_foo('a')` succeeded. Is it right?
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-6/+6
2013-08-04extra: make sure time::match_digits does not read past the end of the strErick Tryzelaar-7/+11
2013-08-04Implemented TreeMap::{lower_bound_iter,upper_bound_iter}Dmitry Ermolov-4/+146
(issue #4604)
2013-08-04Remove redundant print.Dmitry Ermolov-1/+0
2013-08-04Additional check in treemap iterator test.Dmitry Ermolov-0/+1
2013-08-03auto merge of #8264 : thestinger/rust/snapshot, r=Aatchbors-236/+236
2013-08-03remove obsolete `foreach` keywordDaniel Micay-236/+236
this has been replaced by `for`
2013-08-03auto merge of #8246 : stepancheg/rust/contains-key, r=thestingerbors-10/+0
Map::contains_key can be implemented with Map::find. Remove several implementations of contains_key.