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

Commit e5a40e0

Browse files
committed
unimplemented encode/decode implementations for wasm and other unknowns
The cfg() guards around the encode/decode implementations result in the crate being unusable on wasm32-unknown-unknown or any non-unix non-windows non-redox target. These lines mark the functionality as unimplemented on those platforms (which is a sane behavior for platforms like wasm or bare-metal microprocessors given those have no file system), which makes the crate as a whole usable again for file system unrelated tasks like encoding using the "cbor" crate.
1 parent 71b8d6e commit e5a40e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/serialize.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,10 @@ impl Encodable for path::Path {
13711371
let v = self.as_os_str().encode_wide().collect::<Vec<_>>();
13721372
v.encode(e)
13731373
}
1374+
#[cfg(not(any(target_os = "redox", unix, windows)))]
1375+
fn encode<S: Encoder>(&self, _e: &mut S) -> Result<(), S::Error> {
1376+
unimplemented!();
1377+
}
13741378
}
13751379

13761380
impl Encodable for path::PathBuf {
@@ -1406,6 +1410,10 @@ impl Decodable for path::PathBuf {
14061410
p.push(s);
14071411
Ok(p)
14081412
}
1413+
#[cfg(not(any(target_os = "redox", unix, windows)))]
1414+
fn decode<D: Decoder>(_d: &mut D) -> Result<path::PathBuf, D::Error> {
1415+
unimplemented!();
1416+
}
14091417
}
14101418

14111419
impl<T: Encodable + Copy> Encodable for Cell<T> {

0 commit comments

Comments
 (0)