aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2017-04-21 21:25:10 -0500
committerJorge Aparicio <jorge@japaric.io>2017-04-21 21:25:10 -0500
commit296c88c49cbe72aea9d3726147a9436902b3446b (patch)
treefb86d57d834cf401483e498428c5d913b7a5892d /src
parenteea803008390cbae307e873ce6d39e01d6367759 (diff)
add `borrow_mut` to Local
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 910635f..a0c8a3b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -407,6 +407,14 @@ impl<T, TASK> Local<T, TASK> {
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<T, TASK> Sync for Local<T, TASK> {}