diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-21 16:08:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-21 08:08:23 -0600 |
commit | 142449ecab20006c5cfd15462814650596bc034d (patch) | |
tree | b4e796585f870fbf0b1ebe696a474abb1a09d2ac /ext/fetch/lib.rs | |
parent | cf6f649829fbb0562681bc9db0c4c1261d4a40b1 (diff) |
refactor: rewrite some ops to op2 macro (#20603)
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r-- | ext/fetch/lib.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index 4485a3dbe..dd3526ff8 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -21,6 +21,7 @@ use deno_core::futures::FutureExt; use deno_core::futures::Stream; use deno_core::futures::StreamExt; use deno_core::op; +use deno_core::op2; use deno_core::BufView; use deno_core::WriteOutcome; @@ -411,10 +412,11 @@ pub struct FetchResponse { pub remote_addr_port: Option<u16>, } -#[op] +#[op2(async)] +#[serde] pub async fn op_fetch_send( state: Rc<RefCell<OpState>>, - rid: ResourceId, + #[smi] rid: ResourceId, ) -> Result<FetchResponse, AnyError> { let request = state .borrow_mut() @@ -463,10 +465,11 @@ pub async fn op_fetch_send( }) } -#[op] +#[op2(async)] +#[smi] pub async fn op_fetch_response_upgrade( state: Rc<RefCell<OpState>>, - rid: ResourceId, + #[smi] rid: ResourceId, ) -> Result<ResourceId, AnyError> { let raw_response = state .borrow_mut() @@ -811,10 +814,11 @@ fn default_true() -> bool { true } -#[op] +#[op2] +#[smi] pub fn op_fetch_custom_client<FP>( state: &mut OpState, - args: CreateHttpClientArgs, + #[serde] args: CreateHttpClientArgs, ) -> Result<ResourceId, AnyError> where FP: FetchPermissions + 'static, |