Skip to content

Commit

Permalink
Remove Cloning on WorkerBridge. (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo authored Oct 9, 2023
1 parent 02471e6 commit 92510b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 3 additions & 17 deletions crates/worker/src/actor/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where
inner: Rc<WorkerBridgeInner<W>>,
id: HandlerId,
_worker: PhantomData<W>,
cb: Option<Rc<dyn Fn(W::Output)>>,
_cb: Option<Rc<dyn Fn(W::Output)>>,
}

impl<W> WorkerBridge<W>
Expand Down Expand Up @@ -106,7 +106,7 @@ where
.into(),
id,
_worker: PhantomData,
cb: callback,
_cb: callback,
};
self_.init();

Expand Down Expand Up @@ -140,28 +140,14 @@ where
inner: self.inner.clone(),
id: handler_id,
_worker: PhantomData,
cb,
_cb: cb,
};
self_.init();

self_
}
}

impl<W> Clone for WorkerBridge<W>
where
W: Worker,
{
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
id: self.id,
_worker: PhantomData,
cb: self.cb.clone(),
}
}
}

impl<W> Drop for WorkerBridge<W>
where
W: Worker,
Expand Down

0 comments on commit 92510b4

Please sign in to comment.