Add wasm support

This commit is contained in:
Kevin K 2018-03-20 23:49:38 -04:00
parent 875f6b884b
commit d405cbf2e6
3 changed files with 6 additions and 6 deletions

View file

@ -1,7 +1,7 @@
// Std
use std::ffi::{OsStr, OsString};
use std::io::{self, BufWriter, Write};
#[cfg(feature = "debug")]
#[cfg(all(feature = "debug", not(target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
use std::slice::Iter;
use std::iter::Peekable;

View file

@ -4,9 +4,9 @@ use std::rc::Rc;
use std::borrow::Cow;
use std::fmt::{self, Display, Formatter};
use std::ffi::{OsStr, OsString};
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
use osstringext::OsStrExt3;
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
use std::env;
use std::cmp::{Ord, Ordering};

View file

@ -1,10 +1,10 @@
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
use INVALID_UTF8;
use std::ffi::OsStr;
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
pub trait OsStrExt3 {
fn from_bytes(b: &[u8]) -> &Self;
fn as_bytes(&self) -> &[u8];