-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Feature gate: #![feature(local_key_cell_methods)]
This is a tracking issue for thread local Cell methods: RFC 3184.
Public API
impl<T: 'static> LocalKey<Cell<T>> {
pub fn set(&'static self, value: T);
pub fn get(&'static self) -> T where T: Copy;
pub fn take(&'static self) -> T where T: Default;
pub fn replace(&'static self, value: T) -> T;
}
impl<T: 'static> LocalKey<RefCell<T>> {
pub fn with_borrow<F, R>(&'static self, f: F) -> R where F: FnOnce(&T) -> R;
pub fn with_borrow_mut<F, R>(&'static self, f: F) -> R where F: FnOnce(&mut T) -> R;
pub fn set(&'static self, value: T);
pub fn take(&'static self) -> T where T: Default;
pub fn replace(&'static self, value: T) -> T;
}
Steps / History
- RFC: Thread local Cell methods. rfcs#3184
- Implementation: Implement RFC 3184 - thread local cell methods #92123
- Final comment period (FCP): Tracking issue for thread local Cell methods #92122 (comment)
- Stabilization PR: Stabilize thread local cell methods. #114689
Unresolved Questions
Is the behavior ofYes.set()
(to skip the default initialization) the right behavior?- Are there any other types commonly used as thread locals for which we should do something similar?
- Do we also want anything for
UnsafeCell
? MaybeLocalKey<UnsafeCell<T>>::get()
to get the*mut T
, just likeUnsafeCell<T>::get()
. - Not a blocker for stabilizing this feature. Methods for other types can be a separate feature.
- Do we also want anything for
schneiderfelipejeremyBanks, gilescope, TheRawMeatball, taoroalin, rwestphal and 14 more
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.