refactor(napi): self in Task::compute could be mutable

This commit is contained in:
LongYinan 2020-06-19 16:19:06 +08:00
parent 79401d693e
commit 17cb852a6e
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881
2 changed files with 2 additions and 2 deletions

View file

@ -4,7 +4,7 @@ pub trait Task {
type Output: Send + Sized + 'static; type Output: Send + Sized + 'static;
type JsValue: ValueType; type JsValue: ValueType;
fn compute(&self) -> Result<Self::Output>; fn compute(&mut self) -> Result<Self::Output>;
fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Value<Self::JsValue>>; fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Value<Self::JsValue>>;
} }

View file

@ -51,7 +51,7 @@ impl Task for ComputeFib {
type Output = u32; type Output = u32;
type JsValue = Number; type JsValue = Number;
fn compute(&self) -> Result<Self::Output> { fn compute(&mut self) -> Result<Self::Output> {
Ok(fibonacci_native(self.n)) Ok(fibonacci_native(self.n))
} }