mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-30 15:34:33 +01:00
add borrow_mut
to Local
This commit is contained in:
parent
eea8030083
commit
296c88c49c
1 changed files with 8 additions and 0 deletions
|
@ -407,6 +407,14 @@ impl<T, TASK> Local<T, TASK> {
|
||||||
pub fn borrow<'task>(&'static self, _task: &'task TASK) -> &'task T {
|
pub fn borrow<'task>(&'static self, _task: &'task TASK) -> &'task T {
|
||||||
unsafe { &*self.data.get() }
|
unsafe { &*self.data.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mutably borrows the task local data for the duration of the task
|
||||||
|
pub fn borrow_mut<'task>(
|
||||||
|
&'static self,
|
||||||
|
_task: &'task mut TASK,
|
||||||
|
) -> &'task mut T {
|
||||||
|
unsafe { &mut *self.data.get() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T, TASK> Sync for Local<T, TASK> {}
|
unsafe impl<T, TASK> Sync for Local<T, TASK> {}
|
||||||
|
|
Loading…
Reference in a new issue