Skip to main content

Module dyn_string

Module dyn_string 

Source
Expand description

Byte-slice helpers that complement bytes::Bytes and String.

The C struct string is a length-tagged byte view (uint8_t* plus uint32_t). The Rust port replaces it with bytes::Bytes for shared ownership of message payloads and String for textual data. This module collects the small handful of helpers downstream stages reach for: a stripped-down string_compare (length-prefixed byte ordering) and char-finding wrappers that operate on slices.

Functionsยง

eq_ignore_ascii_case
Case-insensitive ASCII slice equality. Slices of different lengths are unequal.
strchr
Return the byte index of the first occurrence of needle in haystack, or None if absent.
string_compare
Compare two byte slices using the same rule as the C string_compare: shorter slices sort first, otherwise sort lexicographically.
strrchr
Return the byte index of the last occurrence of needle in haystack, or None if absent.