@@ -108,6 +108,11 @@ impl<'a, K, V> IterMut<'a, K, V> {
108
108
}
109
109
110
110
/// Returns a slice of the remaining entries in the iterator.
111
+ pub fn as_slice ( & self ) -> & Slice < K , V > {
112
+ Slice :: from_slice ( self . iter . as_slice ( ) )
113
+ }
114
+
115
+ /// Returns a mutable slice of the remaining entries in the iterator.
111
116
///
112
117
/// To avoid creating `&mut` references that alias, this is forced to consume the iterator.
113
118
pub fn into_slice ( self ) -> & ' a mut Slice < K , V > {
@@ -157,6 +162,16 @@ impl<K, V> IntoIter<K, V> {
157
162
iter : entries. into_iter ( ) ,
158
163
}
159
164
}
165
+
166
+ /// Returns a slice of the remaining entries in the iterator.
167
+ pub fn as_slice ( & self ) -> & Slice < K , V > {
168
+ Slice :: from_slice ( self . iter . as_slice ( ) )
169
+ }
170
+
171
+ /// Returns a mutable slice of the remaining entries in the iterator.
172
+ pub fn as_mut_slice ( & mut self ) -> & mut Slice < K , V > {
173
+ Slice :: from_mut_slice ( self . iter . as_mut_slice ( ) )
174
+ }
160
175
}
161
176
162
177
impl < K , V > Iterator for IntoIter < K , V > {
@@ -199,6 +214,11 @@ impl<'a, K, V> Drain<'a, K, V> {
199
214
pub ( super ) fn new ( iter : vec:: Drain < ' a , Bucket < K , V > > ) -> Self {
200
215
Self { iter }
201
216
}
217
+
218
+ /// Returns a slice of the remaining entries in the iterator.
219
+ pub fn as_slice ( & self ) -> & Slice < K , V > {
220
+ Slice :: from_slice ( self . iter . as_slice ( ) )
221
+ }
202
222
}
203
223
204
224
impl < K , V > Iterator for Drain < ' _ , K , V > {
0 commit comments