pub struct MapItemIter<'d, 'c, S: NorFlash, CI: CacheImpl> { /* private fields */ }
Expand description
Iterator which iterates all non-erased & non-corrupted items in the map.
The iterator will return the (Key, Value) tuple when calling next()
.
If the iterator ends, it will return Ok(None)
.
The following is a simple example of how to use the iterator:
let mut flash = init_flash();
let flash_range = 0x1000..0x3000;
let mut data_buffer = [0; 128];
let mut cache = NoCache::new();
// Create the iterator of map items
let mut iterator = fetch_all_items::<u8, _, _>(
&mut flash,
flash_range.clone(),
&mut cache,
&mut data_buffer
)
.await
.unwrap();
let mut all_items = HashMap::new();
// Iterate through all items, suppose the Key and Value types are u8, u32
while let Some((key, value)) = iterator
.next::<u8, u32>(&mut data_buffer)
.await
.unwrap()
{
// Do somethinmg with the item.
// Please note that for the same key there might be multiple items returned,
// the last one is the current active one.
all_items.insert(key, value);
}
Implementations§
Source§impl<S: NorFlash, CI: CacheImpl> MapItemIter<'_, '_, S, CI>
impl<S: NorFlash, CI: CacheImpl> MapItemIter<'_, '_, S, CI>
Auto Trait Implementations§
impl<'d, 'c, S, CI> Freeze for MapItemIter<'d, 'c, S, CI>
impl<'d, 'c, S, CI> RefUnwindSafe for MapItemIter<'d, 'c, S, CI>where
S: RefUnwindSafe,
CI: RefUnwindSafe,
impl<'d, 'c, S, CI> Send for MapItemIter<'d, 'c, S, CI>
impl<'d, 'c, S, CI> Sync for MapItemIter<'d, 'c, S, CI>
impl<'d, 'c, S, CI> Unpin for MapItemIter<'d, 'c, S, CI>
impl<'d, 'c, S, CI> !UnwindSafe for MapItemIter<'d, 'c, S, CI>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more