Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

seralize Path/PathBuf as &str/String for wasm32 #191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ array! {
}

impl Encodable for path::Path {
#[cfg(target_os = "redox")]
#[cfg(any(target_os = "redox", target_arch = "wasm32"))]
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
self.as_os_str().to_str().unwrap().encode(e)
}
Expand All @@ -1380,7 +1380,7 @@ impl Encodable for path::PathBuf {
}

impl Decodable for path::PathBuf {
#[cfg(target_os = "redox")]
#[cfg(any(target_os = "redox", target_arch = "wasm32"))]
fn decode<D: Decoder>(d: &mut D) -> Result<path::PathBuf, D::Error> {
let string: String = try!(Decodable::decode(d));
let s: OsString = OsString::from(string);
Expand Down