Skip to main content

STRING_TYPE

Static STRING_TYPE 

Source
pub static STRING_TYPE: BuiltinTypeDef
Expand description

The built-in String type.

Layout: { ptr: u64, len: u64, cap: u64 } (24 bytes)

  • ptr: Pointer to heap-allocated byte buffer (or .rodata for literals)
  • len: Current length in bytes
  • cap: Capacity of allocated buffer (0 for .rodata literals)

String is a move type (not Copy) because it owns heap-allocated memory. The drop function checks cap > 0 before freeing, allowing .rodata literals (with cap = 0) to be safely dropped without freeing.