Skip to main content

parse_streaming

Function parse_streaming 

Source
pub fn parse_streaming<'a>(
    buffer: &'a [u8],
    options: &ParseOptions,
    streaming_threshold: usize,
) -> Result<ParseProgress<'a>, ParseError>
Expand description

Parse a memcache command with streaming support for large values.

For SET commands with values >= streaming_threshold, this returns NeedValue after parsing the header, allowing the caller to receive the value directly into a target buffer.

For all other commands (including small SETs), it behaves identically to Command::parse_with_options().

§Arguments

  • buffer - The input buffer containing memcache protocol data
  • options - Parse options (max lengths, etc.)
  • streaming_threshold - Minimum value size for streaming (use STREAMING_THRESHOLD)

§Returns

  • Ok(ParseProgress::Incomplete) - Need more data
  • Ok(ParseProgress::NeedValue { .. }) - SET header parsed, value pending
  • Ok(ParseProgress::Complete(cmd, consumed)) - Fully parsed command
  • Err(ParseError) - Parse error