about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libserialize/serialize.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs
index a94df9975a4..115bb6cb6f3 100644
--- a/src/libserialize/serialize.rs
+++ b/src/libserialize/serialize.rs
@@ -14,6 +14,7 @@
 Core encoding and decoding interfaces.
 */
 
+use std::path;
 use std::rc::Rc;
 use std::vec;
 use std::vec_ng::Vec;
@@ -625,6 +626,32 @@ impl<
     }
 }
 
+impl<E: Encoder> Encodable<E> for path::posix::Path {
+    fn encode(&self, e: &mut E) {
+        self.as_vec().encode(e)
+    }
+}
+
+impl<D: Decoder> Decodable<D> for path::posix::Path {
+    fn decode(d: &mut D) -> path::posix::Path {
+        let bytes: ~[u8] = Decodable::decode(d);
+        path::posix::Path::new(bytes)
+    }
+}
+
+impl<E: Encoder> Encodable<E> for path::windows::Path {
+    fn encode(&self, e: &mut E) {
+        self.as_vec().encode(e)
+    }
+}
+
+impl<D: Decoder> Decodable<D> for path::windows::Path {
+    fn decode(d: &mut D) -> path::windows::Path {
+        let bytes: ~[u8] = Decodable::decode(d);
+        path::windows::Path::new(bytes)
+    }
+}
+
 // ___________________________________________________________________________
 // Helper routines
 //