diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-03-14 23:14:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 18:44:15 +0100 |
commit | b4e42953e1d243f2eda20e5be6b845d60b7bf688 (patch) | |
tree | 10b3bfff165f9c04f9174c7c399d44b9b724c3b3 /core/extensions.rs | |
parent | 4e3ed37037a2aa1edeac260dc3463a81d9cf9b88 (diff) |
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'core/extensions.rs')
-rw-r--r-- | core/extensions.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/extensions.rs b/core/extensions.rs index 031cb073a..7361165f0 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -1,12 +1,13 @@ -use crate::OpFn; +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use crate::OpState; use anyhow::Error; use std::task::Context; pub type SourcePair = (&'static str, Box<SourceLoadFn>); pub type SourceLoadFn = dyn Fn() -> Result<String, Error>; -pub type OpPair = (&'static str, Box<OpFn>); -pub type OpMiddlewareFn = dyn Fn(&'static str, Box<OpFn>) -> Box<OpFn>; +pub type OpFnRef = v8::FunctionCallback; +pub type OpPair = (&'static str, OpFnRef); +pub type OpMiddlewareFn = dyn Fn(&'static str, OpFnRef) -> OpFnRef; pub type OpStateFn = dyn Fn(&mut OpState) -> Result<(), Error>; pub type OpEventLoopFn = dyn Fn(&mut OpState, &mut Context) -> bool; @@ -108,7 +109,7 @@ impl ExtensionBuilder { pub fn middleware<F>(&mut self, middleware_fn: F) -> &mut Self where - F: Fn(&'static str, Box<OpFn>) -> Box<OpFn> + 'static, + F: Fn(&'static str, OpFnRef) -> OpFnRef + 'static, { self.middleware = Some(Box::new(middleware_fn)); self |