pub struct ArgvBorrowed<'a> { /* private fields */ }Expand description
A parsed command’s argument vector that borrows its bytes from a contiguous input buffer.
Unlike Argv, which packs all argument bytes into a fresh Vec<u8>,
ArgvBorrowed stores only a (start, end) table over the original buffer.
get(i) returns &input[s..e], so no copy happens on the parse → dispatch
path. Calls that need to outlive the buffer (cross-shard, MULTI queue, AOF)
use into_owned to convert to Argv.
A5 (2026-06-20): the range table is a (u32, u32) × 4 inline + heap-spill
InlineRanges. Commands with ≤4 args (PING/GET/SET/INCR/MGET ≤4 keys —
the vast majority of the -c1 hot mix) pay zero malloc/free for the
ranges. H1 (perf c2c) confirmed libc cfree on the per-request Vec
allocation showed up in cross-thread contention; the inline tier removes
that source.
Implementations§
Source§impl<'a> ArgvBorrowed<'a>
impl<'a> ArgvBorrowed<'a>
Sourcepub fn new(input: &'a [u8]) -> ArgvBorrowed<'a>
pub fn new(input: &'a [u8]) -> ArgvBorrowed<'a>
An empty argv that will read arg bytes from input.
Sourcepub fn with_capacity(input: &'a [u8], argc: usize) -> ArgvBorrowed<'a>
pub fn with_capacity(input: &'a [u8], argc: usize) -> ArgvBorrowed<'a>
An empty argv, pre-sizing ranges for argc args.
Sourcepub fn get(&self, i: usize) -> Option<&[u8]>
pub fn get(&self, i: usize) -> Option<&[u8]>
Argument i as a byte slice into the original input, or None.
Sourcepub fn iter(&self) -> impl Iterator<Item = &[u8]>
pub fn iter(&self) -> impl Iterator<Item = &[u8]>
Iterate the arguments as byte slices into the original input.
Sourcepub fn into_owned(self) -> Argv
pub fn into_owned(self) -> Argv
Materialise an owned Argv — copies arg bytes into a fresh buffer.
Used at any handoff juncture (cross-shard dispatch, MULTI queue, AOF
logging) that needs to outlive the original input buffer.
Trait Implementations§
Source§impl ArgvView for ArgvBorrowed<'_>
impl ArgvView for ArgvBorrowed<'_>
Source§impl<'a> Clone for ArgvBorrowed<'a>
impl<'a> Clone for ArgvBorrowed<'a>
Source§fn clone(&self) -> ArgvBorrowed<'a>
fn clone(&self) -> ArgvBorrowed<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more