diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-12-20 13:38:07 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2022-03-05 11:39:03 +0100 |
| commit | 88a693c4f44b3e267fec108a5572f1e534d4e795 (patch) | |
| tree | cb83fb81b7f6534dc5ac54f7add7e643fc49fa57 /library/std/src/thread | |
| parent | 52ce11996bb437f46ebe046940ab53d1e5781d4b (diff) | |
| download | rust-88a693c4f44b3e267fec108a5572f1e534d4e795.tar.gz rust-88a693c4f44b3e267fec108a5572f1e534d4e795.zip | |
Rename LocalKey's with_{ref,mut} to with_borrow{,_mut}.
Diffstat (limited to 'library/std/src/thread')
| -rw-r--r-- | library/std/src/thread/local.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 03a402a5a47..b73c9270929 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -604,10 +604,10 @@ impl<T: 'static> LocalKey<RefCell<T>> { /// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new()); /// } /// - /// X.with_ref(|v| assert!(v.is_empty())); + /// X.with_borrow(|v| assert!(v.is_empty())); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] - pub fn with_ref<F, R>(&'static self, f: F) -> R + pub fn with_borrow<F, R>(&'static self, f: F) -> R where F: FnOnce(&T) -> R, { @@ -636,12 +636,12 @@ impl<T: 'static> LocalKey<RefCell<T>> { /// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new()); /// } /// - /// X.with_mut(|v| v.push(1)); + /// X.with_borrow_mut(|v| v.push(1)); /// - /// X.with_ref(|v| assert_eq!(*v, vec![1])); + /// X.with_borrow(|v| assert_eq!(*v, vec![1])); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] - pub fn with_mut<F, R>(&'static self, f: F) -> R + pub fn with_borrow_mut<F, R>(&'static self, f: F) -> R where F: FnOnce(&mut T) -> R, { @@ -673,7 +673,7 @@ impl<T: 'static> LocalKey<RefCell<T>> { /// /// X.set(vec![1, 2, 3]); // But X.set() is fine, as it skips the initializer above. /// - /// X.with_ref(|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")] pub fn set(&'static self, value: T) { @@ -706,13 +706,13 @@ impl<T: 'static> LocalKey<RefCell<T>> { /// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new()); /// } /// - /// X.with_mut(|v| v.push(1)); + /// X.with_borrow_mut(|v| v.push(1)); /// /// let a = X.take(); /// /// assert_eq!(a, vec![1]); /// - /// X.with_ref(|v| assert!(v.is_empty())); + /// X.with_borrow(|v| assert!(v.is_empty())); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] pub fn take(&'static self) -> T @@ -744,7 +744,7 @@ impl<T: 'static> LocalKey<RefCell<T>> { /// let prev = X.replace(vec![1, 2, 3]); /// assert!(prev.is_empty()); /// - /// X.with_ref(|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")] pub fn replace(&'static self, value: T) -> T { |
