space_left

Function space_left 

Source
pub async fn space_left<S: NorFlash>(
    flash: &mut S,
    flash_range: Range<u32>,
    cache: &mut impl CacheImpl,
) -> Result<u32, Error<S::Error>>
Expand description

Calculate how much space is left free in the queue (in bytes).

The number given back is accurate, however there are lots of things that add overhead and padding. Every push is an item with its own overhead. You can check the overhead per item with crate::item_overhead_size.

Furthermore, every item has to fully fit in a page. So if a page has 50 bytes left and you push an item of 60 bytes, the current page is closed and the item is stored on the next page, ‘wasting’ the 50 you had.

So unless you’re tracking all this, the returned number should only be used as a rough indication.