@@ -1002,23 +1002,26 @@ impl<T> RawTable<T> {
1002
1002
}
1003
1003
1004
1004
/// Returns an iterator which removes all elements from the table without
1005
- /// freeing the memory. It is up to the caller to ensure that the `RawTable`
1006
- /// outlives the `RawDrain`. Because we cannot make the `next` method unsafe
1007
- /// on the `RawDrain`, we have to make the `drain` method unsafe.
1005
+ /// freeing the memory.
1006
+ ///
1007
+ /// It is up to the caller to ensure that the `RawTable` outlives the `RawDrain`.
1008
+ /// Because we cannot make the `next` method unsafe on the `RawDrain`,
1009
+ /// we have to make the `drain` method unsafe.
1008
1010
#[ cfg_attr( feature = "inline-more" , inline) ]
1009
1011
pub unsafe fn drain ( & mut self ) -> RawDrain < ' _ , T > {
1010
1012
let iter = self . iter ( ) ;
1011
1013
self . drain_iter_from ( iter)
1012
1014
}
1013
1015
1014
1016
/// Returns an iterator which removes all elements from the table without
1015
- /// freeing the memory. It is up to the caller to ensure that the `RawTable`
1016
- /// outlives the `RawDrain`. Because we cannot make the `next` method unsafe
1017
- /// on the `RawDrain`, we have to make the `drain` method unsafe.
1017
+ /// freeing the memory.
1018
1018
///
1019
- /// Iteration starts at the provided iterator's current location.
1019
+ /// It is up to the caller to ensure that the `RawTable` outlives the `RawDrain`.
1020
+ /// Because we cannot make the `next` method unsafe on the `RawDrain`,
1021
+ /// we have to make the `drain` method unsafe.
1020
1022
///
1021
- /// This method panics if the given iterator does not cover all items remaining in the table.
1023
+ /// Iteration starts at the provided iterator's current location.
1024
+ /// You must ensure that the iterator covers all items that remain in the table.
1022
1025
#[ cfg_attr( feature = "inline-more" , inline) ]
1023
1026
pub unsafe fn drain_iter_from ( & mut self , iter : RawIter < T > ) -> RawDrain < ' _ , T > {
1024
1027
debug_assert_eq ! ( iter. len( ) , self . len( ) ) ;
@@ -1032,9 +1035,12 @@ impl<T> RawTable<T> {
1032
1035
1033
1036
/// Returns an iterator which consumes all elements from the table.
1034
1037
///
1035
- /// Iteration starts at the provided iterator's current location.
1038
+ /// It is up to the caller to ensure that the `RawTable` outlives the `RawIntoIter`.
1039
+ /// Because we cannot make the `next` method unsafe on the `RawIntoIter`,
1040
+ /// we have to make the `into_iter_from` method unsafe.
1036
1041
///
1037
- /// This method panics if the given iterator does not cover all items remaining in the table.
1042
+ /// Iteration starts at the provided iterator's current location.
1043
+ /// You must ensure that the iterator covers all items that remain in the table.
1038
1044
pub unsafe fn into_iter_from ( self , iter : RawIter < T > ) -> RawIntoIter < T > {
1039
1045
debug_assert_eq ! ( iter. len( ) , self . len( ) ) ;
1040
1046
0 commit comments