Function store_item

Source
pub async fn store_item<'d, K: Key, V: Value<'d>, S: NorFlash>(
    flash: &mut S,
    flash_range: Range<u32>,
    cache: &mut impl KeyCacheImpl<K>,
    data_buffer: &mut [u8],
    key: &K,
    item: &V,
) -> Result<(), Error<S::Error>>
Expand description

Store a key-value pair into flash memory. It will overwrite the last value that has the same key. The flash needs to be at least 2 pages long.

The data buffer must be long enough to hold the longest serialized data of your Key + Value types combined, rounded up to flash word alignment.

You are required to, on a given flash range, use the same Key type every time. You are allowed to use multiple Value types. See the module-level docs for more information about this.

Also watch out for using integers. This function will take any integer and it’s easy to pass the wrong type.