Skip to main content

namespaced

Function namespaced 

Source
pub fn namespaced(prefix: &str, key: &[u8]) -> Bytes
Expand description

Creates a namespaced key by prefixing with the given prefix.

Uses a stack buffer for small keys (<=96 bytes) to avoid heap allocation during key construction. Returns Bytes which is cheap to clone into async blocks (just an atomic ref count increment after the initial copy).

§Arguments

  • prefix - The namespace prefix to prepend
  • key - The key to namespace

§Returns

A Bytes containing the prefixed key.