diff options
Diffstat (limited to 'core/extensions.rs')
-rw-r--r-- | core/extensions.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/extensions.rs b/core/extensions.rs index fa6d7851e..e76b4064b 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -65,6 +65,12 @@ pub type OpMiddlewareFn = dyn Fn(OpDecl) -> OpDecl; pub type OpStateFn = dyn FnOnce(&mut OpState); pub type OpEventLoopFn = dyn Fn(Rc<RefCell<OpState>>, &mut Context) -> bool; +/// Trait implemented by all generated ops. +pub trait Op { + const NAME: &'static str; + const DECL: OpDecl; +} + pub struct OpDecl { pub name: &'static str, pub v8_fn_ptr: OpFnRef, @@ -239,7 +245,7 @@ macro_rules! extension { ext.ops(vec![ $( $( #[ $m ] )* - $( $op )::+ :: decl $( :: < $($op_param),* > )? () + $( $op )::+ $( :: < $($op_param),* > )? :: decl () ),+ ]); )? |