@@ -682,6 +682,7 @@ async fn remove_item_inner<K: Key, S: MultiwriteNorFlash>(
682
682
/// # use sequential_storage::cache::NoCache;
683
683
/// # use mock_flash::MockFlashBase;
684
684
/// # use futures::executor::block_on;
685
+ /// # use std::collections::HashMap;
685
686
/// # type Flash = MockFlashBase<10, 1, 4096>;
686
687
/// # mod mock_flash {
687
688
/// # include!("mock_flash.rs");
@@ -706,15 +707,18 @@ async fn remove_item_inner<K: Key, S: MultiwriteNorFlash>(
706
707
/// .await
707
708
/// .unwrap();
708
709
///
710
+ /// let mut all_items = HashMap::new();
711
+ ///
709
712
/// // Iterate through all items, suppose the Key and Value types are u8, u32
710
- /// while let Ok( Some((key, value) )) = iterator
713
+ /// while let Some((key, value)) = iterator
711
714
/// .next::<u8, u32>(&mut data_buffer)
712
715
/// .await
716
+ /// .unwrap()
713
717
/// {
714
718
/// // Do somethinmg with the item.
715
719
/// // Please note that for the same key there might be multiple items returned,
716
720
/// // the last one is the current active one.
717
- /// println!("{ key}:{ value}" );
721
+ /// all_items.insert( key, value);
718
722
/// }
719
723
/// # })
720
724
/// ```
@@ -811,6 +815,7 @@ impl<S: NorFlash, CI: CacheImpl> MapItemIter<'_, '_, S, CI> {
811
815
/// # use sequential_storage::cache::NoCache;
812
816
/// # use mock_flash::MockFlashBase;
813
817
/// # use futures::executor::block_on;
818
+ /// # use std::collections::HashMap;
814
819
/// # type Flash = MockFlashBase<10, 1, 4096>;
815
820
/// # mod mock_flash {
816
821
/// # include!("mock_flash.rs");
@@ -835,14 +840,18 @@ impl<S: NorFlash, CI: CacheImpl> MapItemIter<'_, '_, S, CI> {
835
840
/// .await
836
841
/// .unwrap();
837
842
///
843
+ /// let mut all_items = HashMap::new();
844
+ ///
838
845
/// // Iterate through all items, suppose the Key and Value types are u8, u32
839
- /// while let Ok( Some((key, value) )) = iterator
846
+ /// while let Some((key, value)) = iterator
840
847
/// .next::<u8, u32>(&mut data_buffer)
841
848
/// .await
849
+ /// .unwrap()
842
850
/// {
843
851
/// // Do somethinmg with the item.
844
852
/// // Please note that for the same key there might be multiple items returned,
845
853
/// // the last one is the current active one.
854
+ /// all_items.insert(key, value);
846
855
/// }
847
856
/// # })
848
857
/// ```
@@ -1837,7 +1846,6 @@ mod tests {
1837
1846
}
1838
1847
}
1839
1848
1840
- // Check the
1841
1849
assert_eq ! ( last_value_length, 9 ) ;
1842
1850
assert_eq ! (
1843
1851
& last_value_buffer[ ..last_value_length] ,
0 commit comments