@@ -108,6 +108,11 @@ impl<'a, K, V> IterMut<'a, K, V> {
108108 }
109109
110110 /// 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.
111116 ///
112117 /// To avoid creating `&mut` references that alias, this is forced to consume the iterator.
113118 pub fn into_slice ( self ) -> & ' a mut Slice < K , V > {
@@ -157,6 +162,16 @@ impl<K, V> IntoIter<K, V> {
157162 iter : entries. into_iter ( ) ,
158163 }
159164 }
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+ }
160175}
161176
162177impl < K , V > Iterator for IntoIter < K , V > {
@@ -199,6 +214,11 @@ impl<'a, K, V> Drain<'a, K, V> {
199214 pub ( super ) fn new ( iter : vec:: Drain < ' a , Bucket < K , V > > ) -> Self {
200215 Self { iter }
201216 }
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+ }
202222}
203223
204224impl < K , V > Iterator for Drain < ' _ , K , V > {
0 commit comments