diff --git a/Cargo.toml b/Cargo.toml index a1eca0491..b91e25707 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,7 @@ rustdoc-args = ["--cfg", "docsrs"] targets = [ "aarch64-apple-ios", "aarch64-linux-android", + "wasm32-wasi", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-dragonfly", diff --git a/src/poll.rs b/src/poll.rs index aa9d4bada..35f0ec11f 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -635,7 +635,6 @@ impl Registry { /// /// Event sources registered with this `Registry` will be registered with /// the original `Registry` and `Poll` instance. - #[cfg(not(target_os = "wasi"))] pub fn try_clone(&self) -> io::Result { self.selector .try_clone() diff --git a/src/sys/shell/selector.rs b/src/sys/shell/selector.rs index 032631f3a..bfc598a12 100644 --- a/src/sys/shell/selector.rs +++ b/src/sys/shell/selector.rs @@ -11,7 +11,6 @@ pub type Events = Vec; pub struct Selector {} impl Selector { - #[cfg(not(target_os = "wasi"))] pub fn try_clone(&self) -> io::Result { os_required!(); } diff --git a/src/sys/wasi/mod.rs b/src/sys/wasi/mod.rs index f6a2aa02b..e744fe2df 100644 --- a/src/sys/wasi/mod.rs +++ b/src/sys/wasi/mod.rs @@ -110,6 +110,13 @@ impl Selector { } } + pub(crate) fn try_clone(&self) -> io::Result { + Ok(Selector { + id: self.id, + subscriptions: self.subscriptions.clone(), + }) + } + #[cfg(feature = "net")] pub(crate) fn register( &self,