@@ -55,7 +55,7 @@ use std::{
55
55
56
56
use cfg_if:: cfg_if;
57
57
use ordered_multimap:: {
58
- list_ordered_multimap:: { Entry , Iter , IterMut , OccupiedEntry , VacantEntry } ,
58
+ list_ordered_multimap:: { Entry , IntoIter , Iter , IterMut , OccupiedEntry , VacantEntry } ,
59
59
ListOrderedMultimap ,
60
60
} ;
61
61
#[ cfg( feature = "case-insensitive" ) ]
@@ -976,6 +976,29 @@ impl DoubleEndedIterator for SectionIterMut<'_> {
976
976
}
977
977
}
978
978
979
+ /// Iterator for traversing sections
980
+ pub struct SectionIntoIter {
981
+ inner : IntoIter < SectionKey , Properties > ,
982
+ }
983
+
984
+ impl Iterator for SectionIntoIter {
985
+ type Item = ( SectionKey , Properties ) ;
986
+
987
+ fn next ( & mut self ) -> Option < Self :: Item > {
988
+ self . inner . next ( )
989
+ }
990
+
991
+ fn size_hint ( & self ) -> ( usize , Option < usize > ) {
992
+ self . inner . size_hint ( )
993
+ }
994
+ }
995
+
996
+ impl DoubleEndedIterator for SectionIntoIter {
997
+ fn next_back ( & mut self ) -> Option < Self :: Item > {
998
+ self . inner . next_back ( )
999
+ }
1000
+ }
1001
+
979
1002
impl < ' a > Ini {
980
1003
/// Immutable iterate though sections
981
1004
pub fn iter ( & ' a self ) -> SectionIter < ' a > {
@@ -1016,6 +1039,17 @@ impl<'a> IntoIterator for &'a mut Ini {
1016
1039
}
1017
1040
}
1018
1041
1042
+ impl IntoIterator for Ini {
1043
+ type IntoIter = SectionIntoIter ;
1044
+ type Item = ( SectionKey , Properties ) ;
1045
+
1046
+ fn into_iter ( self ) -> Self :: IntoIter {
1047
+ SectionIntoIter {
1048
+ inner : self . sections . into_iter ( ) ,
1049
+ }
1050
+ }
1051
+ }
1052
+
1019
1053
// Ini parser
1020
1054
struct Parser < ' a > {
1021
1055
ch : Option < char > ,
0 commit comments