fn alloc_str(s: &str) -> &'static str
Expand description
Allocates a string in a thread-local arena and returns a reference with a 'static
lifetime.
This function takes a string slice as input and uses a thread-local storage arena to allocate memory for it, ensuring that the memory is associated with the current thread’s local context.
The string is then converted into a raw mutable pointer, which is dereferenced into a reference with a 'static
lifetime.
Unsafe operations are required to perform this operation due to manual memory management and lifetime extension, ensuring that the memory is valid throughout the entire program execution within that thread, without being subject to Rust’s usual borrowing constraints.