diff --git a/src/lib.rs b/src/lib.rs index 910635f341..a0c8a3bac3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -407,6 +407,14 @@ impl Local { pub fn borrow<'task>(&'static self, _task: &'task TASK) -> &'task T { 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 Sync for Local {}