Skip to content
Permalink
Browse files

serialize: add missing Encodable impl for Path.

  • Loading branch information...
eddyb committed May 2, 2019
1 parent a19cf18 commit 9a2ee0aaef1dfe835c65359b2b07721953ea7040
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/libserialize/serialize.rs
@@ -764,12 +764,18 @@ macro_rules! tuple {

tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }

impl Encodable for path::PathBuf {
impl Encodable for path::Path {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
self.to_str().unwrap().encode(e)
}
}

impl Encodable for path::PathBuf {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
path::Path::encode(self, e)
}
}

impl Decodable for path::PathBuf {
fn decode<D: Decoder>(d: &mut D) -> Result<path::PathBuf, D::Error> {
let bytes: String = Decodable::decode(d)?;

0 comments on commit 9a2ee0a

Please sign in to comment.
You can’t perform that action at this time.