| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Also move Void to std::any, move drop to std::mem and reexport in
prelude.
|
|
|
|
No functional changes; just style.
|
|
This replaces the imports from the prelude with the re-exported symbols.
|
|
The following are renamed:
* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`
Fixes #10010.
|
|
Consensus leaned in favour of using rev instead of flip.
|
|
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.
|
|
|
|
Rename existing iterators to get rid of the Iterator suffix and to
give them names that better describe the things being iterated over.
|
|
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)
|
|
This are *trivial* to reimplement in terms of each_reverse if that extra
little bit of performance is needed.
|
|
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)
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
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>
|
|
Also remove all instances of 'self within the codebase.
This fixes #10889.
|
|
|
|
|
|
|
|
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.
|
|
|
|
Who doesn't like a massive renaming?
|
|
|
|
|
|
Use the iterator version instead of the old uint::/int::range_step
functions.
|
|
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.
|
|
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, ...) { ... }
|
|
|
|
cc #5898
|
|
|
|
|
|
Range is now invertable as long as its element type conforms to Integer.
Remove int::range_rev() et al in favor of range().invert().
|
|
Fix inappropriate for-range loops to use for-iterator constructs (or
other appropriate solution) instead.
|
|
|
|
Closes #5506.
|
|
|
|
this has been replaced by `for`
|
|
Map::contains_key can be implemented with Map::find.
Remove several implementations of contains_key.
|
|
|
|
Map::contains_key can be implemented with Map::find.
Remove several implementations of contains_key.
|
|
|
|
|
|
|
|
|
|
A couple of implementations of Container::is_empty weren't exactly
self.len() == 0 so I left them alone (e.g. Treemap).
|