about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2013-08-23test: add support for sharding testsuite by passing --test-shard=a.bGraydon Hoare-2/+36
2013-08-23rt: Remove last use of C++ exchange allocBrian Anderson-1/+4
2013-08-23Fix two small warningsAndrew Dunham-1/+1
2013-08-23Make getopts count (and thus align/paginate) in terms of codepoints not bytes.Felix S. Klock II-2/+3
2013-08-22auto merge of #8596 : vadimcn/rust/master, r=alexcrichtonbors-31/+21
This resolves issue #908. Notable changes: - On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled. However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds. - Linker is invoked via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22Enabled unit tests in std and extra.Vadim Chugunov-31/+21
2013-08-22auto merge of #8666 : nikomatsakis/rust/issue-3678-extern-fn-types, r=pcwaltonbors-11/+15
Change the type of crust fns like this one: extern fn foo() { ... } from `*u8` to `extern "C" fn()`. r? @pcwalton (or whomever)
2013-08-22auto merge of #8616 : kballard/rust/url-parse-errors, r=catamorphismbors-28/+33
Fixes issue #8612.
2013-08-21Make json::to_xxx(&Json) fns Json::to_xxx(&self)Brandon Sanderson-65/+61
to_str, to_pretty_str, to_writer, and to_pretty_writer were at the top level of extra::json, this moves them into an impl for Json to match with what's been done for the rest of libextra and libstd.
2013-08-21extra: change XXX to FIXME and elaborate on commentsTim Chevalier-23/+30
2013-08-21Adjust callbacks in the libraries for the new type of extern fnsNiko Matsakis-11/+15
cc #3678
2013-08-20Deleted fun_treemapSteven Fackler-85/+0
@thestinger and I talked about this in IRC. There are a couple of use cases for a persistent map, but they aren't common enough to justify inclusion in libextra and vary enough that they would require multiple implementations anyways. In any case, fun_treemap in its current state is basically useless.
2013-08-20rm obsolete integer to_str{,_radix} free functionsDaniel Micay-10/+6
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-10/+46
2013-08-19Fix some parsing errors in extra::urlKevin Ballard-28/+33
Fixes issue #8612.
2013-08-18auto merge of #8560 : kballard/rust/reserve-yield, r=pcwaltonbors-14/+14
Rename task::yield() to task::deschedule(). Fixes #8494.
2013-08-18auto merge of #8555 : chris-morgan/rust/time-clone, r=huonwbors-2/+2
I need `Clone` for `Tm` for my latest work on [rust-http](https://github.com/chris-morgan/rust-http) (static typing for headers, and headers like `Date` are a time), so here it is. @huonw recommended deriving DeepClone while I was at it. I also had to implement `DeepClone` for `~str` to get a derived implementation of `DeepClone` for `Tm`; I did `@str` while I was at it, for consistency.
2013-08-18auto merge of #8551 : huonw/rust/speling, r=alexcrichtonbors-9/+9
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-18More spelling corrections.Huon Wilson-6/+6
2013-08-17auto merge of #8272 : DaGenix/rust/digest-md5-impl-not-unrolled, r=cmrbors-42/+471
An MD5 implementation was originally included in #8097, but, since there are a couple different implementations of that digest algorithm (@alco mentioned his implementation on the mailing list just before I opened that PR), it was suggested that I remove it from that PR and open up a new PR to discuss the different implementations and the best way forward. If anyone wants to discuss a different implementation, feel free to present it here and discuss and compare it to this one. I'll just discuss my implementation and I'll leave it to others to present details of theirs. This implementation relies on the FixedBuffer struct from cryptoutil.rs for managing the input buffer, just like the Sha1 and Sha2 digest implementations do. I tried manually unrolling the loops in the compression function, but I got slightly worse performance when I did that. Outside of the #[test]s, I also tested the implementation by generating 1,000 inputs of up to 10MB in size and checking the MD5 digest calculated by this code against the MD5 digest calculated by Java's implementation. On my computer, I'm getting the following performance: ``` test md5::bench::md5_10 ... bench: 52 ns/iter (+/- 1) = 192 MB/s test md5::bench::md5_1k ... bench: 2819 ns/iter (+/- 44) = 363 MB/s test md5::bench::md5_64k ... bench: 178566 ns/iter (+/- 4927) = 367 MB/s ```
2013-08-17auto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichtonbors-0/+795
Addresses part of #7104 This module adds the ability to generate UUIDs (on all Rust-supported platforms). I reviewed the existing UUID support in libraries for a range of languages; Go, D, C#, Java and Boost++. The features were all very similar, and this patch essentially covers the union. The implmentation is quite straightforward, and uses the underlying rng support which is assumed to be sufficiently strong for this purpose. This patch is not complete, however I have put this up for review to gather feedback before finalising. It has tests for most features and documentation for most functions. Outstanding issues: * Only generates V4 (Random) UUIDs. Do we want to support the SHA-1 hash based flavour as well? * Is it worth having the field-based struct public as well as the byte array? * Formatting the string with '-' between groups not done yet. * Parsing full string not done as there appears to be no regexp support yet. I can write a simple manual parser for now? * D has a generator as well. This would be easy to add. However, given the simple interface for creating a new one, and the presence of the macro, is this useful? * Is it worth having a separate UUID trait and specific implementation? Or should it just have a struct+impl with the same name? Currently it feels weird to have the trait (which can't be named UUID so as to conflict) a separate thing. * Should the macro be visible at the top level scope? As this is a first attempt, some code may not be idiomatic. Please comment below... Thanks for all feedback!
2013-08-17Crypto: Add tests for add_bytes_to_bits functions.Palmer Cox-0/+47
2013-08-17Crypto: update checked addition functions to use CheckedAdd intrinsic.Palmer Cox-42/+65
The shift_add_check_overflow and shift_add_check_overflow_tuple functions are re-written to be more efficient and to make use of the CheckedAdd instrinsic instead of manually checking for integer overflow. * The invokation leading_zeros() is removed and replaced with simple integer comparison. The leading_zeros() method results in a ctpop LLVM instruction and it may not be efficient on all architectures; integer comparisons, however, are efficient on just about any architecture. * The methods lose the ability for the caller to specify a particular shift value - that functionality wasn't being used and removing it allows for the code to be simplified. * Finally, the methods are renamed to add_bytes_to_bits and add_bytes_to_bits_tuple to reflect their very specific purposes.
2013-08-17MD5: Create an implementation of MD5.Palmer Cox-0/+331
2013-08-17Crypto: Add little-endian versions of existing functions: read_u32v_le and ↵Palmer Cox-0/+28
write_u32_le.
2013-08-16Reserve 'yield' keywordKevin Ballard-14/+14
Rename task::yield() to task::deschedule(). Fixes #8494.
2013-08-16auto merge of #8532 : kballard/rust/cstr-cleanup, r=ericktbors-5/+5
Implement interior null checking in `.to_c_str()`, among other changes.
2013-08-16Add UUID support to libextraGavin Baker-0/+795
- generate random UUIDs - convert to and from strings and bytes - parse common string formats - implements Zero, Clone, FromStr, ToStr, Eq, TotalEq and Rand - unit tests and documentation - parsing error codes and strings - incorporate feedback from PR review
2013-08-16Implement Clone and DeepClone for time types.Chris Morgan-2/+2
2013-08-16doc: correct spelling in documentation.Huon Wilson-3/+3
2013-08-15vec: rm obsolete zip and zip_sliceDaniel Micay-15/+3
These are obsoleted by the generic iterator `zip` adaptor. Unlike these, it does not clone the elements or allocate a new vector by default.
2013-08-15auto merge of #8490 : huonw/rust/fromiterator-extendable, r=catamorphismbors-21/+20
If they are on the trait then it is extremely annoying to use them as generic parameters to a function, e.g. with the iterator param on the trait itself, if one was to pass an Extendable<int> to a function that filled it either from a Range or a Map<VecIterator>, one needs to write something like: fn foo<E: Extendable<int, Range<int>> + Extendable<int, Map<&'self int, int, VecIterator<int>>> (e: &mut E, ...) { ... } since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>` means that `foo` takes 2 type parameters, and the caller has to specify them (which doesn't work anyway, as they'll mismatch with the iterators used in `foo` itself). This patch changes it to: fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }
2013-08-15Add ToCStr method .with_c_str()Kevin Ballard-5/+5
.with_c_str() is a replacement for the old .as_c_str(), to avoid unnecessary boilerplate. Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-15std: Move the iterator param on FromIterator and Extendable to the method.Huon Wilson-21/+20
If they are on the trait then it is extremely annoying to use them as generic parameters to a function, e.g. with the iterator param on the trait itself, if one was to pass an Extendable<int> to a function that filled it either from a Range or a Map<VecIterator>, one needs to write something like: fn foo<E: Extendable<int, Range<int>> + Extendable<int, Map<&'self int, int, VecIterator<int>>> (e: &mut E, ...) { ... } since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>` means that `foo` takes 2 type parameters, and the caller has to specify them (which doesn't work anyway, as they'll mismatch with the iterators used in `foo` itself). This patch changes it to: fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }
2013-08-14auto merge of #8453 : dmanescu/rust/8451, r=cmrbors-4/+33
I'm not sure that the supplied tests are suitable.
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-12/+12
Closes #5495
2013-08-12auto merge of #8476 : thestinger/rust/snapshot, r=brsonbors-97/+0
2013-08-12fix build with the new snapshot compilerDaniel Micay-97/+0
2013-08-12auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmrbors-3/+61
Use Eq + Ord for lexicographical ordering of sequences. For each of <, <=, >= or > as R, use:: [x, ..xs] R [y, ..ys] = if x != y { x R y } else { xs R ys } Previous code using `a < b` and then `!(b < a)` for short-circuiting fails on cases such as [1.0, 2.0] < [0.0/0.0, 3.0], where the first element was effectively considered equal. Containers like &[T] did also implement only one comparison operator `<`, and derived the comparison results from this. This isn't correct either for Ord. Implement functions in `std::iterator::order::{lt,le,gt,ge,equal,cmp}` that all iterable containers can use for lexical order. We also visit tuple ordering, having the same problem and same solution (but differing implementation).
2013-08-12Fixed #8451 - extra::stats::write_boxplot() applied to negative or zero ↵David Manescu-4/+33
sample values
2013-08-11extra::treemap: Use IteratorUtil::peekableblake2-ppc-88/+46
Replace the previous equivalent iterator adaptor with .peekable(). Refactor the set operation iterators so that they are easier to read.
2013-08-10Merge remote-tracking branch 'remotes/origin/master' into cleanup-iteratorsErick Tryzelaar-13/+13
2013-08-10auto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblumbors-13/+13
I'm a bit disappointed that I couldn't figure out how to factor out more of the code implementing `extra::sync` but I feel this is an okay start. Also I added some documentation explaining that `WaitQueue` isn't thread safe, and needs an exclusive lock. @bblum
2013-08-10std: Iterator.len_ -> .lenErick Tryzelaar-4/+4
2013-08-10std: Iterator.take_ -> .takeErick Tryzelaar-1/+1
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-28/+28
cc #5898
2013-08-10std: merge Iterator and IteratorUtilErick Tryzelaar-3/+1
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-31/+31
cc #7887
2013-08-09auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=ericktbors-15/+115
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects: * No interior nulls * Ends with a trailing null
2013-08-09Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-3/+0
remove-str-trailing-nulls