Skip to content

Commit

Permalink
Merge branch 'master' into cache
Browse files Browse the repository at this point in the history
  • Loading branch information
diondokter committed Feb 5, 2024
2 parents 07e58bd + 5a83522 commit e68bb67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ When using peek_many, you can look at all data from oldest to newest.
(DD-MM-YY)

### Unreleased
- *Breaking* The item to store is now passed by reference to Map `store_item`

- *Breaking* Added cache options to the functions to speed up reading the state of the flash.
To retain the old behaviour you can pass the `NoCache` type as the cache parameter.
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn fuzz(ops: Input) {
FLASH_RANGE,
&mut cache,
&mut buf.0,
item.clone(),
&item,
)) {
Ok(_) => {
map.insert(item.key, item.value);
Expand Down
24 changes: 12 additions & 12 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
//! flash_range.clone(),
//! &mut cache,
//! &mut data_buffer,
//! MyCustomType { key: 42, data: 104729 },
//! &MyCustomType { key: 42, data: 104729 },
//! ).await.unwrap();
//!
//! // When we ask for key 42, we not get back a Some with the correct value
Expand Down Expand Up @@ -262,7 +262,7 @@ pub async fn store_item<I: StorageItem, S: NorFlash>(
flash_range: Range<u32>,
cache: &mut Cache<impl PageStatesCache>,
data_buffer: &mut [u8],
item: I,
item: &I,
) -> Result<(), MapError<I::Error, S::Error>> {
assert_eq!(flash_range.start % S::ERASE_SIZE as u32, 0);
assert_eq!(flash_range.end % S::ERASE_SIZE as u32, 0);
Expand Down Expand Up @@ -764,7 +764,7 @@ mod tests {
flash_range.clone(),
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: 0,
value: vec![5],
},
Expand All @@ -776,7 +776,7 @@ mod tests {
flash_range.clone(),
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: 0,
value: vec![5, 6],
},
Expand All @@ -802,7 +802,7 @@ mod tests {
flash_range.clone(),
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: 1,
value: vec![2, 2, 2, 2, 2, 2],
},
Expand Down Expand Up @@ -842,7 +842,7 @@ mod tests {
flash_range.clone(),
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: (index % 10) as u8,
value: vec![(index % 10) as u8 * 2; index % 10],
},
Expand Down Expand Up @@ -872,7 +872,7 @@ mod tests {
flash_range.clone(),
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: 11,
value: vec![0; 10],
},
Expand Down Expand Up @@ -921,7 +921,7 @@ mod tests {
0x00..0x40,
&mut cache::NoCache::new(),
&mut data_buffer,
item,
&item,
)
.await
.unwrap();
Expand All @@ -933,7 +933,7 @@ mod tests {
0x00..0x40,
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: UPPER_BOUND,
value: vec![0; UPPER_BOUND as usize],
},
Expand Down Expand Up @@ -979,7 +979,7 @@ mod tests {
0x0000..0x1000,
&mut cache::NoCache::new(),
&mut data_buffer,
item,
&item,
)
.await
.unwrap();
Expand All @@ -991,7 +991,7 @@ mod tests {
0x0000..0x1000,
&mut cache::NoCache::new(),
&mut data_buffer,
MockStorageItem {
&MockStorageItem {
key: UPPER_BOUND,
value: vec![0; UPPER_BOUND as usize],
},
Expand Down Expand Up @@ -1039,7 +1039,7 @@ mod tests {
0x0000..0x4000,
&mut cache::NoCache::new(),
&mut data_buffer,
item,
&item,
)
.await
.unwrap();
Expand Down

0 comments on commit e68bb67

Please sign in to comment.