pub unsafe fn str_to_uchar(pool: *mut ngx_pool_s, data: &str) -> *mut u8
Expand description
Convert a string slice (&str
) to a raw pointer (*mut u_char
) allocated in the given nginx memory pool.
§Arguments
pool
- A pointer to the nginx memory pool (ngx_pool_t
).data
- The string slice to convert to a raw pointer.
§Safety
This function is marked as unsafe because it involves raw pointer manipulation and direct memory allocation using ngx_pnalloc
.
§Returns
A raw pointer (*mut u_char
) to the allocated memory containing the converted string data.
§Example
ⓘ
let pool: *mut ngx_pool_t = ...; // Obtain a pointer to the nginx memory pool
let data: &str = "example"; // The string to convert
let ptr = str_to_uchar(pool, data);