summaryrefslogtreecommitdiff
path: root/runtime/ops
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-06 10:28:53 +0100
committerGitHub <noreply@github.com>2024-09-06 11:28:53 +0200
commit5dedb49ac4e18874ce2973ac7c0e491d5ec68155 (patch)
treed98987ab561f67f01157457178b974610c966c60 /runtime/ops
parent73ab32c55124124467ce66eca2220bc4a5dfad0f (diff)
refactor(permissions): remove FromStr implementations, add ::parse methods (#25473)
The `.parse()` calls in permission code are only making it more confusing, verbosity is encouraged and welcome in this code even at the cost of not being concise. Left a couple TODOs to not use `AnyError`.
Diffstat (limited to 'runtime/ops')
-rw-r--r--runtime/ops/permissions.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs
index 9ac9205e9..e6974efad 100644
--- a/runtime/ops/permissions.rs
+++ b/runtime/ops/permissions.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use ::deno_permissions::parse_sys_kind;
+use ::deno_permissions::NetDescriptor;
use ::deno_permissions::PermissionState;
use ::deno_permissions::PermissionsContainer;
use deno_core::error::custom_error;
@@ -63,7 +64,7 @@ pub fn op_query_permission(
"net" => permissions.net.query(
match args.host.as_deref() {
None => None,
- Some(h) => Some(h.parse()?),
+ Some(h) => Some(NetDescriptor::parse(h)?),
}
.as_ref(),
),
@@ -97,7 +98,7 @@ pub fn op_revoke_permission(
"net" => permissions.net.revoke(
match args.host.as_deref() {
None => None,
- Some(h) => Some(h.parse()?),
+ Some(h) => Some(NetDescriptor::parse(h)?),
}
.as_ref(),
),
@@ -131,7 +132,7 @@ pub fn op_request_permission(
"net" => permissions.net.request(
match args.host.as_deref() {
None => None,
- Some(h) => Some(h.parse()?),
+ Some(h) => Some(NetDescriptor::parse(h)?),
}
.as_ref(),
),