read_str_unchecked

Function read_str_unchecked 

Source
pub unsafe fn read_str_unchecked(
    buffer: &[u8],
    offset: usize,
    length: usize,
) -> &str
Expand description

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

This is the fastest option - it skips null terminator scanning AND UTF-8 validation. Only use this in hot query paths where you KNOW the strings are valid UTF-8 (from build time).

ยงSafety

Caller must ensure:

  • offset + length <= buffer.len()
  • Bytes are DEFINITELY valid UTF-8 (undefined behavior if not!)
  • Length is correct