@@ -147,11 +147,11 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockWriteGuard<'_, T> {}
147
147
/// RAII structure used to release the shared read access of a lock when
148
148
/// dropped, which can point to a subfield of the protected data.
149
149
///
150
- /// This structure is created by the [`map`] and [`try_map `] methods
150
+ /// This structure is created by the [`map`] and [`filter_map `] methods
151
151
/// on [`RwLockReadGuard`].
152
152
///
153
153
/// [`map`]: RwLockReadGuard::map
154
- /// [`try_map `]: RwLockReadGuard::try_map
154
+ /// [`filter_map `]: RwLockReadGuard::filter_map
155
155
#[ must_use = "if unused the RwLock will immediately unlock" ]
156
156
#[ must_not_suspend = "holding a MappedRwLockReadGuard across suspend \
157
157
points can cause deadlocks, delays, \
@@ -176,11 +176,11 @@ unsafe impl<T: ?Sized + Sync> Sync for MappedRwLockReadGuard<'_, T> {}
176
176
/// RAII structure used to release the exclusive write access of a lock when
177
177
/// dropped, which can point to a subfield of the protected data.
178
178
///
179
- /// This structure is created by the [`map`] and [`try_map `] methods
179
+ /// This structure is created by the [`map`] and [`filter_map `] methods
180
180
/// on [`RwLockWriteGuard`].
181
181
///
182
182
/// [`map`]: RwLockWriteGuard::map
183
- /// [`try_map `]: RwLockWriteGuard::try_map
183
+ /// [`filter_map `]: RwLockWriteGuard::filter_map
184
184
#[ must_use = "if unused the RwLock will immediately unlock" ]
185
185
#[ must_not_suspend = "holding a MappedRwLockWriteGuard across suspend \
186
186
points can cause deadlocks, delays, \
@@ -788,7 +788,7 @@ impl<T: ?Sized> Deref for MappedRwLockReadGuard<'_, T> {
788
788
789
789
fn deref ( & self ) -> & T {
790
790
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
791
- // was created, and have been upheld throughout `map` and/or `try_map `.
791
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
792
792
unsafe { self . data . as_ref ( ) }
793
793
}
794
794
}
@@ -799,7 +799,7 @@ impl<T: ?Sized> Deref for MappedRwLockWriteGuard<'_, T> {
799
799
800
800
fn deref ( & self ) -> & T {
801
801
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
802
- // was created, and have been upheld throughout `map` and/or `try_map `.
802
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
803
803
unsafe { self . data . as_ref ( ) }
804
804
}
805
805
}
@@ -808,7 +808,7 @@ impl<T: ?Sized> Deref for MappedRwLockWriteGuard<'_, T> {
808
808
impl < T : ?Sized > DerefMut for MappedRwLockWriteGuard < ' _ , T > {
809
809
fn deref_mut ( & mut self ) -> & mut T {
810
810
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
811
- // was created, and have been upheld throughout `map` and/or `try_map `.
811
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
812
812
unsafe { self . data . as_mut ( ) }
813
813
}
814
814
}
@@ -838,7 +838,7 @@ impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> {
838
838
impl < T : ?Sized > Drop for MappedRwLockReadGuard < ' _ , T > {
839
839
fn drop ( & mut self ) {
840
840
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
841
- // was created, and have been upheld throughout `map` and/or `try_map `.
841
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
842
842
unsafe {
843
843
self . inner_lock . read_unlock ( ) ;
844
844
}
@@ -850,7 +850,7 @@ impl<T: ?Sized> Drop for MappedRwLockWriteGuard<'_, T> {
850
850
fn drop ( & mut self ) {
851
851
self . poison_flag . done ( & self . poison ) ;
852
852
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
853
- // was created, and have been upheld throughout `map` and/or `try_map `.
853
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
854
854
unsafe {
855
855
self . inner_lock . write_unlock ( ) ;
856
856
}
@@ -878,7 +878,7 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
878
878
U : ?Sized ,
879
879
{
880
880
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
881
- // was created, and have been upheld throughout `map` and/or `try_map `.
881
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
882
882
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
883
883
// passed to it. If the closure panics, the guard will be dropped.
884
884
let data = NonNull :: from ( f ( unsafe { orig. data . as_ref ( ) } ) ) ;
@@ -893,22 +893,21 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
893
893
/// The `RwLock` is already locked for reading, so this cannot fail.
894
894
///
895
895
/// This is an associated function that needs to be used as
896
- /// `RwLockReadGuard::try_map (...)`. A method would interfere with methods
896
+ /// `RwLockReadGuard::filter_map (...)`. A method would interfere with methods
897
897
/// of the same name on the contents of the `RwLockReadGuard` used through
898
898
/// `Deref`.
899
899
///
900
900
/// # Panics
901
901
///
902
902
/// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned.
903
- #[ doc( alias = "filter_map" ) ]
904
903
#[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
905
- pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
904
+ pub fn filter_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
906
905
where
907
906
F : FnOnce ( & T ) -> Option < & U > ,
908
907
U : ?Sized ,
909
908
{
910
909
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
911
- // was created, and have been upheld throughout `map` and/or `try_map `.
910
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
912
911
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
913
912
// passed to it. If the closure panics, the guard will be dropped.
914
913
match f ( unsafe { orig. data . as_ref ( ) } ) {
@@ -943,7 +942,7 @@ impl<'a, T: ?Sized> MappedRwLockReadGuard<'a, T> {
943
942
U : ?Sized ,
944
943
{
945
944
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
946
- // was created, and have been upheld throughout `map` and/or `try_map `.
945
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
947
946
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
948
947
// passed to it. If the closure panics, the guard will be dropped.
949
948
let data = NonNull :: from ( f ( unsafe { orig. data . as_ref ( ) } ) ) ;
@@ -958,22 +957,21 @@ impl<'a, T: ?Sized> MappedRwLockReadGuard<'a, T> {
958
957
/// The `RwLock` is already locked for reading, so this cannot fail.
959
958
///
960
959
/// This is an associated function that needs to be used as
961
- /// `MappedRwLockReadGuard::try_map (...)`. A method would interfere with
960
+ /// `MappedRwLockReadGuard::filter_map (...)`. A method would interfere with
962
961
/// methods of the same name on the contents of the `MappedRwLockReadGuard`
963
962
/// used through `Deref`.
964
963
///
965
964
/// # Panics
966
965
///
967
966
/// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned.
968
- #[ doc( alias = "filter_map" ) ]
969
967
#[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
970
- pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
968
+ pub fn filter_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
971
969
where
972
970
F : FnOnce ( & T ) -> Option < & U > ,
973
971
U : ?Sized ,
974
972
{
975
973
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
976
- // was created, and have been upheld throughout `map` and/or `try_map `.
974
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
977
975
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
978
976
// passed to it. If the closure panics, the guard will be dropped.
979
977
match f ( unsafe { orig. data . as_ref ( ) } ) {
@@ -1008,7 +1006,7 @@ impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> {
1008
1006
U : ?Sized ,
1009
1007
{
1010
1008
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
1011
- // was created, and have been upheld throughout `map` and/or `try_map `.
1009
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
1012
1010
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
1013
1011
// passed to it. If the closure panics, the guard will be dropped.
1014
1012
let data = NonNull :: from ( f ( unsafe { & mut * orig. lock . data . get ( ) } ) ) ;
@@ -1029,22 +1027,21 @@ impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> {
1029
1027
/// The `RwLock` is already locked for writing, so this cannot fail.
1030
1028
///
1031
1029
/// This is an associated function that needs to be used as
1032
- /// `RwLockWriteGuard::try_map (...)`. A method would interfere with methods
1030
+ /// `RwLockWriteGuard::filter_map (...)`. A method would interfere with methods
1033
1031
/// of the same name on the contents of the `RwLockWriteGuard` used through
1034
1032
/// `Deref`.
1035
1033
///
1036
1034
/// # Panics
1037
1035
///
1038
1036
/// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned.
1039
- #[ doc( alias = "filter_map" ) ]
1040
1037
#[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
1041
- pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
1038
+ pub fn filter_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
1042
1039
where
1043
1040
F : FnOnce ( & mut T ) -> Option < & mut U > ,
1044
1041
U : ?Sized ,
1045
1042
{
1046
1043
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
1047
- // was created, and have been upheld throughout `map` and/or `try_map `.
1044
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
1048
1045
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
1049
1046
// passed to it. If the closure panics, the guard will be dropped.
1050
1047
match f ( unsafe { & mut * orig. lock . data . get ( ) } ) {
@@ -1147,7 +1144,7 @@ impl<'a, T: ?Sized> MappedRwLockWriteGuard<'a, T> {
1147
1144
U : ?Sized ,
1148
1145
{
1149
1146
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
1150
- // was created, and have been upheld throughout `map` and/or `try_map `.
1147
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
1151
1148
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
1152
1149
// passed to it. If the closure panics, the guard will be dropped.
1153
1150
let data = NonNull :: from ( f ( unsafe { orig. data . as_mut ( ) } ) ) ;
@@ -1168,22 +1165,21 @@ impl<'a, T: ?Sized> MappedRwLockWriteGuard<'a, T> {
1168
1165
/// The `RwLock` is already locked for writing, so this cannot fail.
1169
1166
///
1170
1167
/// This is an associated function that needs to be used as
1171
- /// `MappedRwLockWriteGuard::try_map (...)`. A method would interfere with
1168
+ /// `MappedRwLockWriteGuard::filter_map (...)`. A method would interfere with
1172
1169
/// methods of the same name on the contents of the `MappedRwLockWriteGuard`
1173
1170
/// used through `Deref`.
1174
1171
///
1175
1172
/// # Panics
1176
1173
///
1177
1174
/// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned.
1178
- #[ doc( alias = "filter_map" ) ]
1179
1175
#[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
1180
- pub fn try_map < U , F > ( mut orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
1176
+ pub fn filter_map < U , F > ( mut orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
1181
1177
where
1182
1178
F : FnOnce ( & mut T ) -> Option < & mut U > ,
1183
1179
U : ?Sized ,
1184
1180
{
1185
1181
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
1186
- // was created, and have been upheld throughout `map` and/or `try_map `.
1182
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
1187
1183
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
1188
1184
// passed to it. If the closure panics, the guard will be dropped.
1189
1185
match f ( unsafe { orig. data . as_mut ( ) } ) {
0 commit comments