Function sp_database::with_get

source ·
pub fn with_get<R, H: Clone + AsRef<[u8]>>(
    db: &dyn Database<H>,
    col: ColumnId,
    key: &[u8],
    f: impl FnMut(&[u8]) -> R
) -> Option<R>
Expand description

Call f with the value previously stored against key and return the result, or None if key is not currently in the database.

This may be faster than get since it doesn’t allocate.