pub struct StringPool { /* private fields */ }Expand description
String pool structure
The data of the string pool is an array of u32 that provides the
indices in the pool. The pool itself is located at strings_start
offset. Each item of the pool is composed of:
- the string length (16 bits, more details below)
- the string (in UTF-16 format)
- a terminator (0x0000)
The length is 16 bits long, but the system only uses 15 bits, which means that the maximum length of a string is 32,676 characters. If a string has more than 32767 characters, the high bit of the length is set and the 15 remaining bits represent the high word of the total length. In this case, the length will be immediately followed by another 16 bits which represent the low end of the string length. This means the format allows for string lengths up to 2,147,483,648 characters.
If style_count is not zero, then immediately following the array
of indices into the string table is another array of indices into
a style table starting at styles_start. Each entry in the style
table is an array of string_pool_span structures.