pub fn prefix_range(prefix: &[u8]) -> (Bound<Vec<u8>>, Bound<Vec<u8>>)Expand description
Returns the bound pair that matches exactly the keys carrying prefix.
The upper bound is Excluded(next_prefix(prefix)), falling back to
Bound::Unbounded when the prefix has no successor (see
next_prefix).
use std::ops::Bound;
use fasm_storage::prefix_range;
let (start, end) = prefix_range(&[0x10, 0x20]);
assert_eq!(start, Bound::Included(vec![0x10, 0x20]));
assert_eq!(end, Bound::Excluded(vec![0x10, 0x21]));
let (_, end) = prefix_range(&[0xFF, 0xFF]);
assert_eq!(end, Bound::Unbounded);