Closed notgull closed 4 years ago
I am happy to accept a PR for this!
A minor issue: const pointer dereferencing requires the #![feature(const_raw_ptr_deref)]
feature gate. In order to get around this, I propose adding a new feature gate to cstr_core
, to the tune of const_unsafe_new
. When this feature is enabled; from_bytes_with_nul_unchecked
will be const
; otherwise, it will not be. Enabling this feature would require a nightly compiler. I would like to know if this is an acceptable API change.
That sounds good to me. Traditionally I've used the "nightly"
feature name for things like this.
It would be nice if I were able to initialize CStr's in a constant context. The standard library equivalent has this functionality, and it doesn't seem like the implementation here is different from that. If there if interest, I am willing to implement a pull request for this feature.