Skip to content

Commit

Permalink
Support Registry::try_clone on wasm32-wasi
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Zak <richard@profian.com>
  • Loading branch information
rjzak authored Jun 4, 2022
1 parent a2a4d12 commit bcb6dd7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Registry> {
self.selector
.try_clone()
Expand Down
1 change: 0 additions & 1 deletion src/sys/shell/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub type Events = Vec<Event>;
pub struct Selector {}

impl Selector {
#[cfg(not(target_os = "wasi"))]
pub fn try_clone(&self) -> io::Result<Selector> {
os_required!();
}
Expand Down
7 changes: 7 additions & 0 deletions src/sys/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ impl Selector {
}
}

pub(crate) fn try_clone(&self) -> io::Result<Selector> {
Ok(Selector {
id: self.id,
subscriptions: self.subscriptions.clone(),
})
}

#[cfg(feature = "net")]
pub(crate) fn register(
&self,
Expand Down

0 comments on commit bcb6dd7

Please sign in to comment.