read_cstring_with_len

Function read_cstring_with_len 

Source
pub unsafe fn read_cstring_with_len(
    buffer: &[u8],
    offset: usize,
    length: usize,
) -> Result<&str, &'static str>
Expand description

Helper to read a UTF-8 string from buffer with known length (FAST PATH)

This is much faster than read_cstring because it doesn’t scan for the null terminator. Use this when you have the string length from PatternEntry.pattern_string_length.

§Safety

Caller must ensure:

  • offset + length <= buffer.len()
  • Bytes are valid UTF-8
  • Length is correct