diff options
Diffstat (limited to 'ext/net/lib.rs')
-rw-r--r-- | ext/net/lib.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/net/lib.rs b/ext/net/lib.rs index fb8dda514..1695fd264 100644 --- a/ext/net/lib.rs +++ b/ext/net/lib.rs @@ -9,6 +9,7 @@ pub mod raw; pub mod resolve_addr; use deno_core::error::AnyError; +use deno_core::op2; use deno_core::OpState; use deno_tls::rustls::RootCertStore; use deno_tls::RootCertStoreProvider; @@ -96,6 +97,14 @@ deno_core::extension!(deno_net, #[cfg(unix)] ops_unix::op_node_unstable_net_listen_unixpacket<P>, #[cfg(unix)] ops_unix::op_net_recv_unixpacket, #[cfg(unix)] ops_unix::op_net_send_unixpacket<P>, + + #[cfg(not(unix))] op_net_accept_unix, + #[cfg(not(unix))] op_net_connect_unix, + #[cfg(not(unix))] op_net_listen_unix, + #[cfg(not(unix))] op_net_listen_unixpacket, + #[cfg(not(unix))] op_node_unstable_net_listen_unixpacket, + #[cfg(not(unix))] op_net_recv_unixpacket, + #[cfg(not(unix))] op_net_send_unixpacket, ], esm = [ "01_net.js", "02_tls.js" ], options = { @@ -111,3 +120,20 @@ deno_core::extension!(deno_net, )); }, ); + +macro_rules! stub_op { + ($name:ident) => { + #[op2(fast)] + fn $name() { + panic!("Unsupported on non-unix platforms") + } + }; +} + +stub_op!(op_net_accept_unix); +stub_op!(op_net_connect_unix); +stub_op!(op_net_listen_unix); +stub_op!(op_net_listen_unixpacket); +stub_op!(op_node_unstable_net_listen_unixpacket); +stub_op!(op_net_recv_unixpacket); +stub_op!(op_net_send_unixpacket); |