-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Whether I'm using an NgxStr or NgxString, there is no method that can give me an ngx_str_t - I still have to construct that record out of pointers myself, e.g. let s: NgxStr = ...; let ngx_s: ngx_str_t = ngx_str_t { data: s.as_bytes().ptr(), len: s.len() }
.
While it could be unsafe to let the pointer escape the lifetime of the NgxStr (and we have no way to track that because the C FFI type here escapes Rust's lifetime system, its required often enough when calling nginx apis that we should at least make it slightly more convenient.
I think that we can add unsafe fn as_ngx_str(&self) -> ngx_str_t
as a method on NgxStr? Or is the right place to add it on NgxString? Not 100% sure, and open to feedback. Maybe there is some reason this method was left out I haven't thought of