Edward Wang
e9ff91e9be
Move replace and swap to std::mem. Get rid of std::util
...
Also move Void to std::any, move drop to std::mem and reexport in
prelude.
2014-02-11 05:21:35 +08:00
Brian Anderson
d433b80e02
std: Add init and uninit to mem. Replace direct intrinsic usage
2014-02-09 00:17:40 -08:00
chromatic
b91b6a746b
Cleaned up imports per coding standards.
...
No functional changes; just style.
2014-02-07 09:59:19 -08:00
chromatic
813886b22c
Removed prelude::* from libstd files.
...
This replaces the imports from the prelude with the re-exported symbols.
2014-02-07 09:59:19 -08:00
Chris Wong
988e4f0a1c
Uppercase numeric constants
...
The following are renamed:
* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`
Fixes #10010 .
2014-01-25 21:38:25 +13: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
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
Huon Wilson
0148055a56
std::trie: use unsafe code to give a 3x speed up to the iterator.
...
This stores the stack of iterators inline (we have a maximum depth with
`uint` keys), and then uses direct pointer offsetting to manipulate it,
in a blazing fast way:
Before:
bench_iter_large ... bench: 43187 ns/iter (+/- 3082)
bench_iter_small ... bench: 618 ns/iter (+/- 288)
After:
bench_iter_large ... bench: 13497 ns/iter (+/- 1575)
bench_iter_small ... bench: 220 ns/iter (+/- 91)
2014-01-18 10:46:11 +11:00
Huon Wilson
f0c554d0d8
std::trie: remove each_{key,value}_reverse internal iterators.
...
This are *trivial* to reimplement in terms of each_reverse if that extra
little bit of performance is needed.
2014-01-18 10:45:34 +11:00
Huon Wilson
e1ebdb8790
std::trie: optimise insert slightly.
...
This reduces the number of moves/memcpy's we do, which makes insert
faster, especially in cases of keys with long equal prefixes (the
_low_bits tests):
Before:
bench_insert_large ... bench: 553966 ns/iter (+/- 64050)
bench_insert_large_low_bits ... bench: 1048151 ns/iter (+/- 92484)
bench_insert_small ... bench: 168840 ns/iter (+/- 22410)
bench_insert_small_low_bits ... bench: 185069 ns/iter (+/- 38332)
After:
bench_insert_large ... bench: 422132 ns/iter (+/- 35112)
bench_insert_large_low_bits ... bench: 339083 ns/iter (+/- 34421)
bench_insert_small ... bench: 134539 ns/iter (+/- 15254)
bench_insert_small_low_bits ... bench: 88775 ns/iter (+/- 5746)
2014-01-15 12:03:21 +11:00
Huon Wilson
6b5e63ff2d
std::trie: add benchmarks for insert.
2014-01-15 11:32:53 +11:00
Huon Wilson
7e446af759
std::trie: make lower_bound and upper_bound about 15% faster.
...
I believe this is mainly due to code-size reduction.
Before:
test [...]::bench_lower_bound ... bench: 818 ns/iter (+/- 100)
test [...]::bench_upper_bound ... bench: 939 ns/iter (+/- 34)
After:
test [...]::bench_lower_bound ... bench: 698 ns/iter (+/- 60)
test [...]::bench_upper_bound ... bench: 817 ns/iter (+/- 20)
2014-01-08 00:31:24 +11:00
Huon Wilson
3395f9d6a1
std::trie: Add some iteration/search benchmarks.
2014-01-08 00:31:24 +11:00
Huon Wilson
fe03caedf0
std::trie: use macros to share code between the iterator implementations.
2014-01-08 00:31:24 +11:00
Huon Wilson
f07c74d93a
std::trie: remove some obsolete internal iterators.
2014-01-08 00:31:24 +11:00
Huon Wilson
a0643ee9ae
std::trie: add an mutable-values iterator.
2014-01-08 00:31:23 +11: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
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
Alex Crichton
ab387a6838
Register new snapshots
2013-11-28 20:27:56 -08:00
Patrick Walton
1eca34de7d
libstd: Remove all non-proc uses of do from libstd
2013-11-26 08:23:57 -08:00
Marvin Löbel
24b316a3b9
Removed unneccessary _iter suffixes from various APIs
2013-11-26 10:02:26 +01:00
Jannis Harder
525878fc96
std::trie: Fix find_mut for non-present keys
...
Make TrieMap/TrieSet's find_mut check the key for external nodes.
Without this find_mut sometimes returns a reference to another key when
querying for a non-present key.
2013-11-25 00:09:40 +01:00
Patrick Walton
1946265e1a
libstd: Change all uses of &fn(A)->B over to |A|->B in libstd
2013-11-19 12:40:19 -08:00
Alex Crichton
daf5f5a4d1
Drop the '2' suffix from logging macros
...
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Daniel Micay
6a90e80b62
option: rewrite the API to use composition
2013-10-09 09:17:29 -04:00
Alex Crichton
a8ba31dbf3
std: Remove usage of fmt!
2013-09-30 23:21:18 -07:00
blake2-ppc
ad74fde62f
Use std::iter::range_step
...
Use the iterator version instead of the old uint::/int::range_step
functions.
2013-09-15 00:41:34 -04:00
Daniel Micay
6919cf5fe1
rename std::iterator to std::iter
...
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
Huon Wilson
53487a0246
std: Move the iterator param on FromIterator and Extendable to the method.
...
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-15 01:10:45 +10:00
Erick Tryzelaar
4e92faad13
Merge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup
2013-08-10 13:01:20 -07:00
Erick Tryzelaar
68f40d215e
std: Rename Iterator.transform -> .map
...
cc #5898
2013-08-10 07:33:21 -07:00
Erick Tryzelaar
4062b84f4a
std: merge Iterator and IteratorUtil
2013-08-10 07:02:17 -07:00
Dmitry Ermolov
2a2ea5e276
Implement lower_bound_iter/upper_bound_iter for TrieMap/TrieSet
2013-08-09 15:51:49 +04:00
Kevin Ballard
8964fcc5ac
Implement DoubleEndedIterator on Range
...
Range is now invertable as long as its element type conforms to Integer.
Remove int::range_rev() et al in favor of range().invert().
2013-08-07 22:41:09 -04:00
blake2-ppc
40bdbf0f5d
std: Fix for-range loops that can use iterators
...
Fix inappropriate for-range loops to use for-iterator constructs (or
other appropriate solution) instead.
2013-08-07 22:39:57 -04:00
Dmitry Ermolov
28165d5ad8
Remove debug printing.
2013-08-05 02:51:43 +04:00
Dmitry Ermolov
d49bb43fc1
Implemented iterator for TrieMap
...
Closes #5506 .
2013-08-05 02:29:51 +04:00
bors
fbeeeebf47
auto merge of #8264 : thestinger/rust/snapshot, r=Aatch
2013-08-03 23:25:55 -07:00
Daniel Micay
1008945528
remove obsolete foreach keyword
...
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
bors
18e3db7392
auto merge of #8246 : stepancheg/rust/contains-key, r=thestinger
...
Map::contains_key can be implemented with Map::find.
Remove several implementations of contains_key.
2013-08-03 13:40:49 -07:00
Daniel Micay
b3ad685f7f
replace all remaining for with foreach or do
2013-08-03 03:00:42 -04:00
Stepan Koltsov
cf9e9b21d5
Add default implementation of Map::contains_key function
...
Map::contains_key can be implemented with Map::find.
Remove several implementations of contains_key.
2013-08-03 05:54:05 +04:00
Daniel Micay
234acad404
replace range with an external iterator
2013-08-02 00:51:14 -04:00
blake2-ppc
b18bd785ec
std: Replace for with do { .. } expr where internal iterators are used
2013-08-01 16:54:22 +02:00
Daniel Micay
1fc4db2d08
migrate many for loops to foreach
2013-08-01 05:34:55 -04:00
blake2-ppc
5307d3674e
std: Implement Extendable for hashmap, str and trie
2013-07-30 02:32:38 +02:00
Steven Fackler
feb18fe8da
Added default impls for container methods
...
A couple of implementations of Container::is_empty weren't exactly
self.len() == 0 so I left them alone (e.g. Treemap).
2013-07-25 15:17:30 -07:00
Brian Anderson
ddd8c156c6
std: Remove old magic core mod
2013-07-19 21:01:24 -04:00