diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-14 08:29:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 08:29:44 +0200 |
commit | bbb348aa33b56e15f376e8e7ee7b71bd5badd936 (patch) | |
tree | 71237cd69672b125c17b5b5aa671afa947847486 /ext/node/ops/idna.rs | |
parent | 2046aeed70efac1e17f1df8873da25e00bb4e2b2 (diff) |
refactor: rewrite ext/node to op2 (#20489)
Diffstat (limited to 'ext/node/ops/idna.rs')
-rw-r--r-- | ext/node/ops/idna.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/node/ops/idna.rs b/ext/node/ops/idna.rs index 8f7cfe34a..988468297 100644 --- a/ext/node/ops/idna.rs +++ b/ext/node/ops/idna.rs @@ -1,26 +1,30 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; -use deno_core::op; +use deno_core::op2; -#[op] +#[op2] +#[string] pub fn op_node_idna_domain_to_ascii( - domain: String, + #[string] domain: String, ) -> Result<String, AnyError> { Ok(idna::domain_to_ascii(&domain)?) } -#[op] -pub fn op_node_idna_domain_to_unicode(domain: String) -> String { +#[op2] +#[string] +pub fn op_node_idna_domain_to_unicode(#[string] domain: String) -> String { idna::domain_to_unicode(&domain).0 } -#[op] -pub fn op_node_idna_punycode_decode(domain: String) -> String { +#[op2] +#[string] +pub fn op_node_idna_punycode_decode(#[string] domain: String) -> String { idna::punycode::decode_to_string(&domain).unwrap_or_default() } -#[op] -pub fn op_node_idna_punycode_encode(domain: String) -> String { +#[op2] +#[string] +pub fn op_node_idna_punycode_encode(#[string] domain: String) -> String { idna::punycode::encode_str(&domain).unwrap_or_default() } |