diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:35:37 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:50:02 +0100 |
| commit | 60ae1590af034755b5cb1e1e71f2240a710299a2 (patch) | |
| tree | 605d11f071a776c0ca33dcfea0a774379b0880bb /src/libstd/smallintmap.rs | |
| parent | 1f71a0f48d18d80ff3be6970d582c5a67f976329 (diff) | |
Switch to new param kind bound syntax
And remove support for the old syntax
Diffstat (limited to 'src/libstd/smallintmap.rs')
| -rw-r--r-- | src/libstd/smallintmap.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 5ba1366ccb5..d40adc84739 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -30,7 +30,7 @@ Function: insert Add a value to the map. If the map already contains a value for the specified key then the original value is replaced. */ -fn insert<copy T>(m: smallintmap<T>, key: uint, val: T) { +fn insert<T: copy>(m: smallintmap<T>, key: uint, val: T) { vec::grow_set::<option::t<T>>(m.v, key, none::<T>, some::<T>(val)); } @@ -40,7 +40,7 @@ Function: find Get the value for the specified key. If the key does not exist in the map then returns none. */ -fn find<copy T>(m: smallintmap<T>, key: uint) -> option::t<T> { +fn find<T: copy>(m: smallintmap<T>, key: uint) -> option::t<T> { if key < vec::len::<option::t<T>>(m.v) { ret m.v[key]; } ret none::<T>; } @@ -54,7 +54,7 @@ Failure: If the key does not exist in the map */ -fn get<copy T>(m: smallintmap<T>, key: uint) -> T { +fn get<T: copy>(m: smallintmap<T>, key: uint) -> T { alt find(m, key) { none. { #error("smallintmap::get(): key not present"); fail; } some(v) { ret v; } @@ -66,13 +66,13 @@ Method: contains_key Returns true if the map contains a value for the specified key */ -fn contains_key<copy T>(m: smallintmap<T>, key: uint) -> bool { +fn contains_key<T: copy>(m: smallintmap<T>, key: uint) -> bool { ret !option::is_none(find::<T>(m, key)); } // FIXME: Are these really useful? -fn truncate<copy T>(m: smallintmap<T>, len: uint) { +fn truncate<T: copy>(m: smallintmap<T>, len: uint) { m.v = vec::slice_mut::<option::t<T>>(m.v, 0u, len); } |
