diff options
author | Valentin Anger <syrupthinker@gryphno.de> | 2020-07-08 17:23:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 11:23:50 -0400 |
commit | be7e0f2d490ca480aaa154845c4c5c6dccbd7546 (patch) | |
tree | b2a2d284c490a2a1cd8ec3b6175ea5d4077cc65e /core/ops.rs | |
parent | cbbd9443592f79f6abf9e5019840de4e01ff8580 (diff) |
BREAKING(core): Remove control slice from ops (#6048)
Diffstat (limited to 'core/ops.rs')
-rw-r--r-- | core/ops.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/ops.rs b/core/ops.rs index eb995df6e..65a0f325b 100644 --- a/core/ops.rs +++ b/core/ops.rs @@ -22,7 +22,7 @@ pub enum Op { /// Main type describing op pub type OpDispatcher = - dyn Fn(&mut CoreIsolateState, &[u8], &mut [ZeroCopyBuf]) -> Op + 'static; + dyn Fn(&mut CoreIsolateState, &mut [ZeroCopyBuf]) -> Op + 'static; #[derive(Default)] pub struct OpRegistry { @@ -33,7 +33,7 @@ pub struct OpRegistry { impl OpRegistry { pub fn new() -> Self { let mut registry = Self::default(); - let op_id = registry.register("ops", |state, _, _| { + let op_id = registry.register("ops", |state, _| { let buf = state.op_registry.json_map(); Op::Sync(buf) }); @@ -43,7 +43,7 @@ impl OpRegistry { pub fn register<F>(&mut self, name: &str, op: F) -> OpId where - F: Fn(&mut CoreIsolateState, &[u8], &mut [ZeroCopyBuf]) -> Op + 'static, + F: Fn(&mut CoreIsolateState, &mut [ZeroCopyBuf]) -> Op + 'static, { let op_id = self.dispatchers.len() as u32; @@ -81,7 +81,7 @@ fn test_op_registry() { let c = Arc::new(atomic::AtomicUsize::new(0)); let c_ = c.clone(); - let test_id = op_registry.register("test", move |_, _, _| { + let test_id = op_registry.register("test", move |_, _| { c_.fetch_add(1, atomic::Ordering::SeqCst); Op::Sync(Box::new([])) }); @@ -97,7 +97,7 @@ fn test_op_registry() { let dispatch = op_registry.get(test_id).unwrap(); let state_rc = CoreIsolate::state(&isolate); let mut state = state_rc.borrow_mut(); - let res = dispatch(&mut state, &[], &mut []); + let res = dispatch(&mut state, &mut []); if let Op::Sync(buf) = res { assert_eq!(buf.len(), 0); } else { @@ -127,10 +127,10 @@ fn register_op_during_call() { let test_id = { let mut g = op_registry.lock().unwrap(); - g.register("dynamic_register_op", move |_, _, _| { + g.register("dynamic_register_op", move |_, _| { let c__ = c_.clone(); let mut g = op_registry_.lock().unwrap(); - g.register("test", move |_, _, _| { + g.register("test", move |_, _| { c__.fetch_add(1, atomic::Ordering::SeqCst); Op::Sync(Box::new([])) }); @@ -148,7 +148,7 @@ fn register_op_during_call() { { let state_rc = CoreIsolate::state(&isolate); let mut state = state_rc.borrow_mut(); - dispatcher1(&mut state, &[], &mut []); + dispatcher1(&mut state, &mut []); } let mut expected = HashMap::new(); @@ -166,7 +166,7 @@ fn register_op_during_call() { }; let state_rc = CoreIsolate::state(&isolate); let mut state = state_rc.borrow_mut(); - let res = dispatcher2(&mut state, &[], &mut []); + let res = dispatcher2(&mut state, &mut []); if let Op::Sync(buf) = res { assert_eq!(buf.len(), 0); } else { |