mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Add tracking issue number for local_key_cell_methods.
This commit is contained in:
parent
88a693c4f4
commit
93c409d6e2
@ -482,7 +482,7 @@ impl<T: 'static> LocalKey<Cell<T>> {
|
|||||||
///
|
///
|
||||||
/// assert_eq!(X.get(), 123);
|
/// assert_eq!(X.get(), 123);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn set(&'static self, value: T) {
|
pub fn set(&'static self, value: T) {
|
||||||
self.initialize_with(Cell::new(value), |init, cell| {
|
self.initialize_with(Cell::new(value), |init, cell| {
|
||||||
if let Some(init) = init {
|
if let Some(init) = init {
|
||||||
@ -513,7 +513,7 @@ impl<T: 'static> LocalKey<Cell<T>> {
|
|||||||
///
|
///
|
||||||
/// assert_eq!(X.get(), 1);
|
/// assert_eq!(X.get(), 1);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn get(&'static self) -> T
|
pub fn get(&'static self) -> T
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
@ -544,7 +544,7 @@ impl<T: 'static> LocalKey<Cell<T>> {
|
|||||||
/// assert_eq!(X.take(), Some(1));
|
/// assert_eq!(X.take(), Some(1));
|
||||||
/// assert_eq!(X.take(), None);
|
/// assert_eq!(X.take(), None);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn take(&'static self) -> T
|
pub fn take(&'static self) -> T
|
||||||
where
|
where
|
||||||
T: Default,
|
T: Default,
|
||||||
@ -575,7 +575,7 @@ impl<T: 'static> LocalKey<Cell<T>> {
|
|||||||
/// assert_eq!(X.replace(2), 1);
|
/// assert_eq!(X.replace(2), 1);
|
||||||
/// assert_eq!(X.replace(3), 2);
|
/// assert_eq!(X.replace(3), 2);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn replace(&'static self, value: T) -> T {
|
pub fn replace(&'static self, value: T) -> T {
|
||||||
self.with(|cell| cell.replace(value))
|
self.with(|cell| cell.replace(value))
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
|||||||
///
|
///
|
||||||
/// X.with_borrow(|v| assert!(v.is_empty()));
|
/// X.with_borrow(|v| assert!(v.is_empty()));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn with_borrow<F, R>(&'static self, f: F) -> R
|
pub fn with_borrow<F, R>(&'static self, f: F) -> R
|
||||||
where
|
where
|
||||||
F: FnOnce(&T) -> R,
|
F: FnOnce(&T) -> R,
|
||||||
@ -640,7 +640,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
|||||||
///
|
///
|
||||||
/// X.with_borrow(|v| assert_eq!(*v, vec![1]));
|
/// X.with_borrow(|v| assert_eq!(*v, vec![1]));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn with_borrow_mut<F, R>(&'static self, f: F) -> R
|
pub fn with_borrow_mut<F, R>(&'static self, f: F) -> R
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut T) -> R,
|
F: FnOnce(&mut T) -> R,
|
||||||
@ -675,7 +675,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
|||||||
///
|
///
|
||||||
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
|
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn set(&'static self, value: T) {
|
pub fn set(&'static self, value: T) {
|
||||||
self.initialize_with(RefCell::new(value), |init, cell| {
|
self.initialize_with(RefCell::new(value), |init, cell| {
|
||||||
if let Some(init) = init {
|
if let Some(init) = init {
|
||||||
@ -714,7 +714,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
|||||||
///
|
///
|
||||||
/// X.with_borrow(|v| assert!(v.is_empty()));
|
/// X.with_borrow(|v| assert!(v.is_empty()));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn take(&'static self) -> T
|
pub fn take(&'static self) -> T
|
||||||
where
|
where
|
||||||
T: Default,
|
T: Default,
|
||||||
@ -746,7 +746,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
|||||||
///
|
///
|
||||||
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
|
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "local_key_cell_methods", issue = "none")]
|
#[unstable(feature = "local_key_cell_methods", issue = "92122")]
|
||||||
pub fn replace(&'static self, value: T) -> T {
|
pub fn replace(&'static self, value: T) -> T {
|
||||||
self.with(|cell| cell.replace(value))
|
self.with(|cell| cell.replace(value))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user