From 17cb852a6ef4d1577943f5698e3d38d88c395a8b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 19 Jun 2020 16:19:06 +0800 Subject: [PATCH] refactor(napi): self in Task::compute could be mutable --- napi/src/task.rs | 2 +- test_module/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/napi/src/task.rs b/napi/src/task.rs index 3951a403..7ff0ffb8 100644 --- a/napi/src/task.rs +++ b/napi/src/task.rs @@ -4,7 +4,7 @@ pub trait Task { type Output: Send + Sized + 'static; type JsValue: ValueType; - fn compute(&self) -> Result; + fn compute(&mut self) -> Result; fn resolve(&self, env: &mut Env, output: Self::Output) -> Result>; } diff --git a/test_module/src/lib.rs b/test_module/src/lib.rs index 12766e82..8b690273 100644 --- a/test_module/src/lib.rs +++ b/test_module/src/lib.rs @@ -51,7 +51,7 @@ impl Task for ComputeFib { type Output = u32; type JsValue = Number; - fn compute(&self) -> Result { + fn compute(&mut self) -> Result { Ok(fibonacci_native(self.n)) }