diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-12-26 18:30:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 02:30:26 +0100 |
commit | 0efe438f7c191d8504355e03b27fe7e3055c9387 (patch) | |
tree | b96fe9a897eb6941c87a95a04520662d26c02fbe /ext/net/lib.rs | |
parent | e33c5eb704c22fad69876e87d9b852a4e5072a7a (diff) |
perf: remove opAsync (#21690)
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.
The `opAsync` API on Deno.core will be removed at a later time.
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); |