about summary refs log tree commit diff
path: root/src/libstd/json.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-08-02 15:42:56 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-08-02 15:53:28 -0700
commit97452c0ca16238a2de5503aca07db26ff9e8ba63 (patch)
tree47ef430d1671ab297bc192009aa74a23723a42fc /src/libstd/json.rs
parent476ce459bd3b687658e566c75d0fb73281450d67 (diff)
Remove modes from map API and replace with regions.
API is (for now) mostly by value, there are options to use it by
reference if you like.  Hash and equality functions must be pure
and by reference (forward looking to the day when something
like send_map becomes the standard map).
Diffstat (limited to 'src/libstd/json.rs')
-rw-r--r--src/libstd/json.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index f2c2a616ede..9faea572338 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -588,18 +588,24 @@ impl of to_json for @~str {
     fn to_json() -> json { string(self) }
 }
 
-impl <A: to_json copy, B: to_json copy> of to_json for (A, B) {
+impl <A: to_json, B: to_json> of to_json for (A, B) {
     fn to_json() -> json {
-        let (a, b) = self;
-        list(@~[a.to_json(), b.to_json()])
+        alt self {
+          (a, b) => {
+            list(@~[a.to_json(), b.to_json()])
+          }
+        }
     }
 }
 
-impl <A: to_json copy, B: to_json copy, C: to_json copy>
+impl <A: to_json, B: to_json, C: to_json>
   of to_json for (A, B, C) {
     fn to_json() -> json {
-        let (a, b, c) = self;
-        list(@~[a.to_json(), b.to_json(), c.to_json()])
+        alt self {
+          (a, b, c) => {
+            list(@~[a.to_json(), b.to_json(), c.to_json()])
+          }
+        }
     }
 }