about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2013-07-11Remove all external requirements of `@` from TLSAlex Crichton-2/+2
Closes #6004
2013-07-10Convert json Reader to iteratorsGary Linscott-40/+26
This is much faster for strings, and eventually when there is a buffered reader of some sort. Reading example.json 100 times before was around 1.18s. After: - reading from string 0.68s - reading from file 1.08s (extra time is all in io::Reader)
2013-07-10Switch over to new range_rev semantics; fix #5270.Felix S. Klock II-2/+2
2013-07-09auto merge of #7265 : brson/rust/io-upstream, r=brsonbors-13/+4
r? @graydon, @nikomatsakis, @pcwalton, or @catamorphism Sorry this is so huge, but it's been accumulating for about a month. There's lots of stuff here, mostly oriented toward enabling multithreaded scheduling and improving compatibility between the old and new runtimes. Adds task pinning so that we can create the 'platform thread' in servo. [Here](https://github.com/brson/rust/blob/e1555f9b5628af2b6c6ed344cad621399cb7684d/src/libstd/rt/mod.rs#L201) is the current runtime setup code. About half of this has already been reviewed.
2013-07-09Rename local_data methods/types for less keystrokesAlex Crichton-4/+4
2013-07-09auto merge of #7117 : jensnockert/rust/freestanding, r=cmrbors-27/+30
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. This means that instead of having to know everywhere what the type is, like ~~~ f64::sin(x) ~~~ You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num. ~~~ num::sin(x) ~~~ Note 1: If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note 2: If you were using a function that corresponds to an operator, use the operator instead. Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
2013-07-09auto merge of #7614 : MarkJr94/rust/smallintmap_enum, r=huonwbors-0/+287
Added external iterators as well as tests to SmallIntMap and SmallIntSet. Fixes #7366
2013-07-08auto merge of #7262 : nikomatsakis/rust/ref-bindings-in-irrefut-patterns, ↵bors-26/+27
r=catamorphism Correct treatment of irrefutable patterns. The old code was wrong in many, many ways. `ref` bindings didn't work, it sometimes copied when it should have moved, the borrow checker didn't even look at such patterns at all, we weren't consistent about preventing values with destructors from being pulled apart, etc. Fixes #3224. Fixes #3225. Fixes #3255. Fixes #6225. Fixes #6386. r? @catamorphism
2013-07-08Merge remote-tracking branch 'mozilla/master'Brian Anderson-1816/+1854
Conflicts: src/libextra/test.rs src/libstd/rt/global_heap.rs src/libstd/unstable/lang.rs src/libstd/vec.rs
2013-07-08auto merge of #7612 : thestinger/rust/utf8, r=huonwbors-1/+1
2013-07-08auto merge of #7608 : glinscott/rust/json_perf, r=pcwaltonbors-7/+28
Avoids the overhead of read_char for every character. Benchmark reading example.json 10 times from https://code.google.com/p/rapidjson/wiki/Performance Before: 2.55s After: 0.16s Regression testing is already done by isrustfastyet.
2013-07-08Correct merge failuresNiko Matsakis-4/+4
2013-07-08extra: Patch up code that was using irrefutable patterns incorrectly.Niko Matsakis-23/+24
2013-07-08Bump version numbers to 0.8-preBrian Anderson-1/+1
2013-07-08Forgot to grep for a functionJens Nockert-1/+1
2013-07-08 Replaces the free-standing functions in f32, &c.Jens Nockert-26/+29
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note: If you were using a function that corresponds to an operator, use the operator instead.
2013-07-08Merge pull request #7595 from thestinger/iteratorDaniel Micay-8/+8
remove some method resolve workarounds
2013-07-07remove some method resolve workaroundsDaniel Micay-8/+8
2013-07-07auto merge of #7629 : thestinger/rust/rope, r=graydonbors-1443/+0
It's broken/unmaintained and needs to be rewritten to avoid managed pointers and needless copies. A full rewrite is necessary and the API will need to be redone so it's not worth keeping this around (#7628). Closes #2236, #2744
2013-07-07auto merge of #7594 : chris-morgan/rust/proper-net-module-structure, r=huonwbors-28/+26
Where * = tcp, ip, url. Formerly, extra::net::* were aliases of extra::net_*, but were the recommended path to use. Thus, the documentation talked of the `net_*` modules while everything else was written expecting `net::*`. This moves the actual modules so that `extra::net::*` is the actual location of the modules. This will naturally break any code which used `extra::net_*` directly. They should be altered to use `extra::net::*` (which has been the documented way of doing things for some time). This ensures that there is one, and only one, obvious way of doing things.
2013-07-06auto merge of #7570 : kballard/rust/iterator-size-hint, r=thestingerbors-2/+12
Change the signature of Iterator.size_hint() to always have a lower bound. Implement .size_hint() on all remaining iterators (if it differs from the default).
2013-07-06Implement size_hint() on all remaining IteratorsKevin Ballard-2/+12
Add size_hint() to the Iterators in libextra and the Iterator in libsyntax. Skip deque for the moment, as it's being worked on elsewhere.
2013-07-06remove extra::ropeDaniel Micay-1443/+0
It's broken/unmaintained and needs to be rewritten to avoid managed pointers and needless copies. A full rewrite is necessary and the API will need to be redone so it's not worth keeping this around. Closes #2236, #2744
2013-07-06deque: Implement Clone and Eq for Dequeblake2-ppc-0/+49
2013-07-06Added external iterators for SmallIntMap and SmallIntSet=Mark Sinclair-0/+287
Adding iterators for extra::smallintmap Working on mutability error Ran into ICE More mutability problems Working through mutability issue working on getting tests passing SmallIntMa tests passing Added SmallIntSet iterators, and the tests are passing Stripped trailing spaces Removed extra use directive
2013-07-06deque: Remove obsolete methods .each() and .eachi()blake2-ppc-30/+1
2013-07-06deque: Implement Deque::with_capacity. Lower initial capacity to 8.blake2-ppc-2/+18
We need a reasonably small initial capacity to make Deques faster for the common case.
2013-07-06deque: Move the shorter part when growingblake2-ppc-7/+25
The deque is split at the marker lo, or logical index 0. Move the shortest part (split by lo) when growing. This way add_front is just as fast as add_back, on average.
2013-07-06deque: Change iterators to use the same index calculation as Dequeblake2-ppc-39/+39
The previous implementation of reverse iterators used modulus (%) of negative indices, which did work but was fragile due to dependency on the divisor.
2013-07-06deque: Add tests for mut_iter and mut_rev_iterblake2-ppc-1/+51
2013-07-06deque: Remove rendundant field hiblake2-ppc-22/+26
The deque is determined by vec self.elts.len(), self.nelts, and self.lo, and self.hi is calculated from these. self.hi is just the raw index of element number `self.nelts`
2013-07-06deque: Implement FromIteratorblake2-ppc-0/+27
So that deque can be used with IteratorUtil::collect()
2013-07-06deque: Speed up deque growth by a lotblake2-ppc-17/+20
Fix some issues with the deque being very slow, keep the same vec around instead of constructing a new. Move as few elements as possible, so the self.lo point is not moved after grow. [o o o o o|o o o] hi...^ ^.... lo grows to [. . . . .|o o o o o o o o|. . .] ^.. lo ^.. hi If the deque is append-only, it will result in moving no elements on grow. If the deque is prepend-only, all will be moved each time. The bench tests added show big improvements: Timed using `rust build -O --test extra.rs && ./extra --bench deque` Old version: test deque::tests::bench_add_back ... bench: 4976 ns/iter (+/- 9) test deque::tests::bench_add_front ... bench: 4108 ns/iter (+/- 18) test deque::tests::bench_grow ... bench: 416964 ns/iter (+/- 4197) test deque::tests::bench_new ... bench: 408 ns/iter (+/- 12) With this commit: test deque::tests::bench_add_back ... bench: 12 ns/iter (+/- 0) test deque::tests::bench_add_front ... bench: 16 ns/iter (+/- 0) test deque::tests::bench_grow ... bench: 1515 ns/iter (+/- 30) test deque::tests::bench_new ... bench: 419 ns/iter (+/- 3)
2013-07-06deque: Add tests and bench testsblake2-ppc-0/+56
Add a test that excercises deque growing. Add bench tests for grow, new, add_back, add_front, to expose how slow these functions are.
2013-07-06deque: Fix grow condition in add_frontblake2-ppc-1/+1
Without this, it will hit the assert in fn grow after 32 consecutive add_front.
2013-07-05str: stop encoding invalid out-of-range `char`Daniel Micay-1/+1
2013-07-05Switch json parsing to read_chars for performanceGary Linscott-7/+28
Avoids the overhead of read_char for every character. Benchmark reading example.json 10 times from https://code.google.com/p/rapidjson/wiki/Performance Before: 2.55s After: 0.16s Regression testing is already done by isrustfastyet.
2013-07-04auto merge of #7530 : alexcrichton/rust/issue-5194, r=thestingerbors-6/+8
Closes #5194
2013-07-05Remove superfluous super::super::Chris Morgan-14/+14
2013-07-05Move `extra::net_*` to `extra::net::*` properly.Chris Morgan-28/+26
Where * = tcp, ip, url. Formerly, extra::net::* were aliases of extra::net_*, but were the recommended path to use. Thus, the documentation talked of the `net_*` modules while everything else was written expecting `net::*`. This moves the actual modules so that `extra::net::*` is the actual location of the modules. This will naturally break any code which used `extra::net_*` directly. They should be altered to use `extra::net::*` (which has been the documented way of doing things for some time). This ensures that there is one, and only one, obvious way of doing things.
2013-07-03Upper-cased exported staticsSteven Fackler-17/+17
2013-07-03Base64 API changesSteven Fackler-34/+57
There's now an enum to pick the character set instead of a url_safe bool. from_base64 now returns a Result<~[u8], ~str> and returns an Err instead of killing the task when it is called on invalid input. Fixed documentation examples.
2013-07-03Added functionality to Base64 packageSteven Fackler-121/+210
The Base64 package previously had extremely basic functionality. It only suported the standard encoding character set, didn't support line breaks and always padded output. This commit makes it significantly more powerful. The FromBase64 impl now supports all of the standard variants of Base64. It ignores newlines,interprets '-' and '_' as well as '+' and '/' and doesn't require padding. It isn't incredibly pedantic and will successfully parse strings that are not strictly valid, but I don't think the extra complexity required to make it accept _only_ valid strings is worth it. The ToBase64 trait has been modified such that to_base64 now takes a base64::Config struct which contains the output format configuration. This currently includes the selection of character set (standard or url safe), whether or not to pad and an optional line break width. The package comes with three static Config structs for the RFC 4648 standard, RFC 4648 url safe and RFC 2045 MIME formats. The other option for configuring ToBase64 output would be to have one method with the configuration flags passed and other traits with default impls for the common cases, but I think that's a little messier.
2013-07-03Merge remote-tracking branch 'mozilla/master'Brian Anderson-1783/+3249
Conflicts: src/libextra/test.rs src/libstd/at_vec.rs src/libstd/cleanup.rs src/libstd/rt/comm.rs src/libstd/rt/global_heap.rs src/libstd/task/spawn.rs src/libstd/unstable/lang.rs src/libstd/vec.rs src/rt/rustrt.def.in src/test/run-pass/extern-pub.rs
2013-07-04Convert vec::{as_imm_buf, as_mut_buf} to methods.Huon Wilson-5/+5
2013-07-04Remove standalone comparison functions in vec, make the trait impls better.Huon Wilson-16/+14
2013-07-04Remove vec::reversed, replaced by iterators.Huon Wilson-8/+11
2013-07-04Remove vec::{filter, filtered, filter_map, filter_mapped}, replaced by ↵Huon Wilson-4/+4
iterators.
2013-07-04Implement consuming iterators for ~[], remove vec::{consume, ↵Huon Wilson-7/+5
consume_reverse, map_consume}.
2013-07-03auto merge of #7523 : huonw/rust/uppercase-statics-lint, r=cmrbors-65/+70
Adds a lint for `static some_lowercase_name: uint = 1;`. Warning by default since it causes confusion, e.g. `static a: uint = 1; ... let a = 2;` => `error: only refutable patterns allowed here`.