diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2022-03-16 00:33:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-16 00:33:46 +0100 |
commit | bd481bf095f920a419ea55543f911e087f98f36f (patch) | |
tree | b4f97aabfd3734770c5367b1253511a02d86af87 /core/runtime.rs | |
parent | 672f66dde1f7ec87282d37e10cac2cdd36e5f181 (diff) |
feat(ops): optional OpState (#13954)
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 17840a2d0..8ec3dfb08 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2088,7 +2088,7 @@ pub mod tests { #[test] fn test_error_builder() { #[op] - fn op_err(_: &mut OpState) -> Result<(), Error> { + fn op_err() -> Result<(), Error> { Err(custom_error("DOMExceptionOperationError", "abc")) } @@ -2533,9 +2533,7 @@ assertEquals(1, notify_return_value); #[tokio::test] async fn test_set_macrotask_callback_set_next_tick_callback() { #[op] - async fn op_async_sleep( - _op_state: Rc<RefCell<OpState>>, - ) -> Result<(), Error> { + async fn op_async_sleep() -> Result<(), Error> { // Future must be Poll::Pending on first call tokio::time::sleep(std::time::Duration::from_millis(1)).await; Ok(()) @@ -2610,13 +2608,13 @@ assertEquals(1, notify_return_value); static NEXT_TICK: AtomicUsize = AtomicUsize::new(0); #[op] - fn op_macrotask(_: &mut OpState) -> Result<(), AnyError> { + fn op_macrotask() -> Result<(), AnyError> { MACROTASK.fetch_add(1, Ordering::Relaxed); Ok(()) } #[op] - fn op_next_tick(_: &mut OpState) -> Result<(), AnyError> { + fn op_next_tick() -> Result<(), AnyError> { NEXT_TICK.fetch_add(1, Ordering::Relaxed); Ok(()) } @@ -2747,13 +2745,13 @@ assertEquals(1, notify_return_value); static UNCAUGHT_EXCEPTION: AtomicUsize = AtomicUsize::new(0); #[op] - fn op_promise_reject(_: &mut OpState) -> Result<(), AnyError> { + fn op_promise_reject() -> Result<(), AnyError> { PROMISE_REJECT.fetch_add(1, Ordering::Relaxed); Ok(()) } #[op] - fn op_uncaught_exception(_: &mut OpState) -> Result<(), AnyError> { + fn op_uncaught_exception() -> Result<(), AnyError> { UNCAUGHT_EXCEPTION.fetch_add(1, Ordering::Relaxed); Ok(()) } |