Amanieu / cstr_core

Implementation of CStr and CString for no_std environments
Apache License 2.0
41 stars 17 forks source link

Make functions const in stable #28

Closed schteve closed 2 years ago

schteve commented 2 years ago

I noticed from_bytes_with_nul_uncheck() and to_bytes_with_nul() can both be made const on stable and they seem to work just fine with a quick test. I assume some const feature was recently stabilized that allows this (not sure which though). Please let me know if I missed anything.

Amanieu commented 2 years ago

From Rust 1.64 (stable on Sept 22), the CStr and CString types are available as core::ffi::CStr and alloc::ffi::CString, at which point this crate isn't needed any more. I'd rather keep things as they are in case someone is relying on this crate with an older version of Rust.

schteve commented 2 years ago

Ok makes sense, might be helpful to add a note as such to the readme then to deter any other contributions.

Amanieu commented 2 years ago

I plan on adding a note as soon as 1.64 is released.