fix compat worker

This commit is contained in:
Quaternions 2023-10-24 20:20:13 -07:00
parent 5d9308eccc
commit 657e5dff7f

View File

@ -7,14 +7,14 @@ pub struct CompatNWorker<Task>{
} }
impl<Task> CompatNWorker<Task>{ impl<Task> CompatNWorker<Task>{
pub fn new(f:impl FnMut(Task))->Self{ pub fn new(f:impl FnMut(Task)+'static)->Self{
Self{ Self{
data:std::marker::PhantomData, data:std::marker::PhantomData,
f:Box::new(f), f:Box::new(f),
} }
} }
pub fn send(&self,task:Task)->Result<(),()>{ pub fn send(&mut self,task:Task)->Result<(),()>{
(self.f)(task); (self.f)(task);
Ok(()) Ok(())
} }