Function keys::next_key[][src]

pub fn next_key(key: &[u8]) -> Vec<u8>

Computes the next key of the given key.

If the key has no successor key (e.g. the input is “\xff\xff”), the result would be an empty vector.

Examples

use keys::next_key;
assert_eq!(next_key(b"123"), b"124");
assert_eq!(next_key(b"12\xff"), b"13");
assert_eq!(next_key(b"\xff\xff"), b"");
assert_eq!(next_key(b"\xff\xfe"), b"\xff\xff");
assert_eq!(next_key(b"T"), b"U");
assert_eq!(next_key(b""), b"");