Skip to content

Commit 88a693c

Browse files
committed
Rename LocalKey's with_{ref,mut} to with_borrow{,_mut}.
1 parent 52ce119 commit 88a693c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

library/std/src/thread/local.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,10 @@ impl<T: 'static> LocalKey<RefCell<T>> {
604604
/// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new());
605605
/// }
606606
///
607-
/// X.with_ref(|v| assert!(v.is_empty()));
607+
/// X.with_borrow(|v| assert!(v.is_empty()));
608608
/// ```
609609
#[unstable(feature = "local_key_cell_methods", issue = "none")]
610-
pub fn with_ref<F, R>(&'static self, f: F) -> R
610+
pub fn with_borrow<F, R>(&'static self, f: F) -> R
611611
where
612612
F: FnOnce(&T) -> R,
613613
{
@@ -636,12 +636,12 @@ impl<T: 'static> LocalKey<RefCell<T>> {
636636
/// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new());
637637
/// }
638638
///
639-
/// X.with_mut(|v| v.push(1));
639+
/// X.with_borrow_mut(|v| v.push(1));
640640
///
641-
/// X.with_ref(|v| assert_eq!(*v, vec![1]));
641+
/// X.with_borrow(|v| assert_eq!(*v, vec![1]));
642642
/// ```
643643
#[unstable(feature = "local_key_cell_methods", issue = "none")]
644-
pub fn with_mut<F, R>(&'static self, f: F) -> R
644+
pub fn with_borrow_mut<F, R>(&'static self, f: F) -> R
645645
where
646646
F: FnOnce(&mut T) -> R,
647647
{
@@ -673,7 +673,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
673673
///
674674
/// X.set(vec![1, 2, 3]); // But X.set() is fine, as it skips the initializer above.
675675
///
676-
/// X.with_ref(|v| assert_eq!(*v, vec![1, 2, 3]));
676+
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
677677
/// ```
678678
#[unstable(feature = "local_key_cell_methods", issue = "none")]
679679
pub fn set(&'static self, value: T) {
@@ -706,13 +706,13 @@ impl<T: 'static> LocalKey<RefCell<T>> {
706706
/// static X: RefCell<Vec<i32>> = RefCell::new(Vec::new());
707707
/// }
708708
///
709-
/// X.with_mut(|v| v.push(1));
709+
/// X.with_borrow_mut(|v| v.push(1));
710710
///
711711
/// let a = X.take();
712712
///
713713
/// assert_eq!(a, vec![1]);
714714
///
715-
/// X.with_ref(|v| assert!(v.is_empty()));
715+
/// X.with_borrow(|v| assert!(v.is_empty()));
716716
/// ```
717717
#[unstable(feature = "local_key_cell_methods", issue = "none")]
718718
pub fn take(&'static self) -> T
@@ -744,7 +744,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
744744
/// let prev = X.replace(vec![1, 2, 3]);
745745
/// assert!(prev.is_empty());
746746
///
747-
/// X.with_ref(|v| assert_eq!(*v, vec![1, 2, 3]));
747+
/// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3]));
748748
/// ```
749749
#[unstable(feature = "local_key_cell_methods", issue = "none")]
750750
pub fn replace(&'static self, value: T) -> T {

0 commit comments

Comments
 (0)