Steven Stewart-Gallus
a8870dfbb5
Minor cleanup of hashmap
2013-07-21 20:10:55 -07:00
blake2-ppc
24b6901b26
std: Implement Clone for VecIterator and iterators using it
...
The theory is simple, the immutable iterators simply hold state
variables (indicies or pointers) into frozen containers. We can freely
clone these iterators, just like we can clone borrowed pointers.
VecIterator needs a manual impl to handle the lifetime struct member.
2013-07-20 20:30:57 +02:00
blake2-ppc
980646a450
Use Option .take() or .take_unwrap() instead of util::replace where possible
2013-07-20 05:12:05 -04:00
bors
3514a5af06
auto merge of #7857 : blake2-ppc/rust/fix-test-warnings, r=alexcrichton
...
Fix warnings that only show up when compiling the tests for libstd, libextra and one in librusti. Only trivial changes.
2013-07-18 20:55:38 -07:00
blake2-ppc
7ef9e722b8
hashmap: Remove .consume() has rename .consume_iter() to .consume()
...
Updated all users of HashMap, HashSet old .consume() to use .consume()
with a for loop.
Since .consume() takes the map or set by value, it needs awkward
extra code to in librusti's use of @mut HashMap, where the map value can
not be directly moved out.
2013-07-18 15:03:59 +02:00
blake2-ppc
ff9b75f26d
Fix warnings in libstd and librusti tests
2013-07-18 02:18:56 +02:00
Patrick Walton
99b33f7219
librustc: Remove all uses of "copy".
2013-07-17 14:57:51 -07:00
blake2-ppc
750f32dbb5
hashmap: Iterators for hashset diff, sym. diff, intersec, union
...
Implement the difference, union, etc iterators with the help of a custom
iterator combinator with explicit closure environment. Reported issue #7814
to be able to use the std::iterator filter combinator.
2013-07-16 04:09:41 +02:00
blake2-ppc
cf4127f503
hashmap: Remove .mutate_values() which is replaced by .mut_iter()
2013-07-16 03:55:52 +02:00
Andrew Paseltiner
faa280cee6
std: add consuming iterators for HashMap
and HashSet
2013-07-15 17:32:53 -04:00
bors
0cb1ac0f9f
auto merge of #7788 : MarkJr94/rust/from_iter, r=cmr
...
Added Iterators for HashMap/Set, TreeMap/Set, TrieMap/Set, and PriorityQueue as per Issue #7626
2013-07-14 12:01:22 -07:00
=Mark Sinclair
bbe03da9c6
Stripped trailing spaces; Implemented FromIterator for TreeMap and PriorityQueue
2013-07-14 13:18:50 -04:00
=Mark Sinclair
bb6615d43a
Implemented FromIterator for TrieMap and TrieSet
2013-07-14 12:20:48 -04:00
=Mark Sinclair
4ff7ef434f
Implemented FromIterator for std::hashmap
2013-07-14 11:26:03 -04:00
Steven Fackler
6b37b5bab7
Split mutable methods out of Set and Map
...
Fixes most of #4989 . I didn't add Persistent{Set,Map} since the only
persistent data structure is fun_treemap and its functionality is
currently too limited to build a trait out of.
2013-07-13 19:44:36 -07:00
Jens Nockert
1aae28a57d
Replaces the free-standing functions in f32, &c.
...
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-08 18:05:17 +02:00
Huon Wilson
eee6775642
Implement consuming iterators for ~[], remove vec::{consume, consume_reverse, map_consume}.
2013-07-04 00:46:49 +10:00
Huon Wilson
a890c2cbf1
Convert vec::{rposition, rposition_elem, position_elem, contains} to methods.
2013-06-30 21:15:24 +10:00
Alex Crichton
b29c368674
Removing a lot of usage of '&const'
2013-06-29 08:35:48 -07:00
Ben Blum
ff4ab9e147
'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep for making them noncopyable.
2013-06-29 04:39:34 -04:00
Daniel Micay
e67c48a591
remove each
from vec, HashMap and HashSet
2013-06-25 16:28:02 -04:00
Daniel Micay
64ee9668a2
container: remove internal iterators from Map
...
the maps are being migrated to external iterators
2013-06-25 16:26:23 -04:00
Daniel Micay
ac2e167e7e
hashmap: add FIXME number
2013-06-23 05:13:13 -04:00
blake2-ppc
13f666a724
std::hashmap: Remove BaseIter impl for HashSet
...
Remove the BaseIter impl, while keeping the .each method until callers
are converted.
2013-06-23 04:23:01 -04:00
blake2-ppc
f045210857
std::hashmap: Use .iter() instead of .each and similar
2013-06-23 04:23:00 -04:00
blake2-ppc
3af1d20bea
std::hashmap: Add test_iterate for HashSet
2013-06-23 04:23:00 -04:00
blake2-ppc
080d498af2
std::hashmap: Implement external iterator for HashMap and HashSet
2013-06-23 04:23:00 -04:00
Daniel Micay
d2e9912aea
vec: remove BaseIter implementation
...
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
Graydon Hoare
d904c72af8
replace #[inline(always)] with #[inline]. r=burningtree.
2013-06-18 14:48:48 -07:00
bors
5bff471dde
auto merge of #7105 : sstewartgallus/rust/removed_unused_imports, r=sanxiyn
...
I was able to remove unused imports, and fix the following warnings
src/libstd/hashmap.rs:23:15: 23:23 warning: unused import [-W unused-imports (default)]
src/libstd/task/spawn.rs:95:15: 95:23 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:42:0: 42:9 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:45:0: 45:9 warning: unused import [-W unused-imports (default)]
src/librustc/middle/trans/meth.rs:26:0: 26:26 warning: unused import [-W unused-imports (default)]
src/librustc/back/link.rs:210:20: 210:25 warning: unused import [-W unused-imports (default)]
I was unable to fix the following unused import warnings. The code
here was weird.
src/libextra/std.rc:40:11: 40:14 warning: unused import [-W unused-imports (default)]
src/libextra/std.rc:40:16: 40:24 warning: unused import [-W unused-imports (default)]
2013-06-13 12:08:05 -07:00
Steven Stewart-Gallus
d9d50a5bd4
Remove unused imports
...
I was able to remove unused imports, and fix the following warnings
src/libstd/hashmap.rs:23:15: 23:23 warning: unused import [-W unused-imports (default)]
src/libstd/task/spawn.rs:95:15: 95:23 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:42:0: 42:9 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:45:0: 45:9 warning: unused import [-W unused-imports (default)]
src/librustc/middle/trans/meth.rs:26:0: 26:26 warning: unused import [-W unused-imports (default)]
src/librustc/back/link.rs:210:20: 210:25 warning: unused import [-W unused-imports (default)]
I was unable to fix the following unused import warnings. The code
here was weird.
src/libextra/std.rc:40:11: 40:14 warning: unused import [-W unused-imports (default)]
src/libextra/std.rc:40:16: 40:24 warning: unused import [-W unused-imports (default)]
2013-06-13 10:46:17 -07:00
Daniel Micay
ed7892ac00
hashmap: remove leftover debug!() logging
2013-06-13 03:25:28 -04:00
Huon Wilson
9fff8c6eba
std: add a test for HashMap::find_equiv.
2013-06-12 12:21:04 +10:00
Daniel Micay
004816f4c6
option: remove redundant old_iter impls
2013-06-11 14:06:12 -04:00
gareth
d443fc6d90
Add a get_mut method to accompany the get method.
2013-06-02 16:22:43 +01:00
Kevin Ballard
75f1b7f96f
Add new function hashmap.insert_or_update_with()
...
fn insert_or_update_with<'a>(&'a mut self,
k: K,
f: &fn(&K, &mut V)) -> &'a V
2013-06-01 17:38:24 -07:00
Kevin Ballard
7bc950c43c
Refactor some hashmap code into a new private function mangle()
...
Add new private hashmap function
fn mangle(&mut self,
k: K,
not_found: &fn(&K) -> V,
found: &fn(&K, &mut V)) -> uint
Rewrite find_or_insert() and find_or_insert_with() on top of mangle().
Also take the opportunity to change the return type of find_or_insert()
and find_or_insert_with() to &'a mut V. This fixes #6394 .
2013-06-01 17:37:57 -07:00
Patrick Walton
5fb254695b
Remove all uses of pub impl
. rs=style
2013-06-01 09:18:27 -07:00
Alex Crichton
d01c7d0d42
Fix a bug with HashMap::consume
2013-05-30 20:45:14 -05:00
Alex Crichton
007651cd26
Require documentation by default for libstd
...
Adds documentation for various things that I understand.
Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-30 01:02:55 -05:00
Patrick Walton
0c820d4123
libstd: Rename libcore to libstd and libstd to libextra; update makefiles.
...
This only changes the directory names; it does not change the "real"
metadata names.
2013-05-22 21:57:05 -07:00