Amanieu / cstr_core

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

Roadmap for after Rust 1.64? #27

Open chrysn opened 2 years ago

chrysn commented 2 years ago

core::ffi::CStr and alloc::ffi::CString have been stabilized for Rust 1.64, which is due to become stable in 9 weeks from now.

Once that has landed, what remains for this crate to do?

Do you intend to keep maintaining the crate as a staging ground for constification of the core library, or other experimentation? Is there any user base that can not go to 1.64 speedily, or that can not do the API change toward core library? (A quick survey of the most popular dependents of cstr_core shows they're all in pre-1.0 stage, and I didn't check which of them use CStr types publicly) Or will this library just be deprecated and development ceased?

If it is kept maintained as a staging ground, it may make sense to provide From and Into for the core types (they should be trivial as they can be unchecked); then APIs can pivot to core's interfaces, and whoever needs const methods can still into them and use cstr_core privately.


From the perspective of using it from riot-wrappers, I'm still checking whether there is any constness that I'm missing from the core library, push for constification if needed (pointing to this project to illustrate it works), and plan to make the API break as soon as 1.64 is available.

chrysn commented 2 years ago

I completely missed that the cstr! macro is not part of std/core. Thus, if you should decide decide to mothball this crates CStr type, there are two ways forward:

Amanieu commented 2 years ago

The point of this crate was to make the CStr and CString types available to no_std code. Now that these types are in core, it is no longer needed and I plan to deprecate this crate.

The cstr! macro should be upstreamed into the standard library.

upsuper commented 2 years ago

To be honest, I feel now that CStr is in core, maybe Rust should just add a new prefix form c"xxx" for static CStr.

chrysn commented 2 years ago

Fine with me, thanks for clarifying.

c"xxx"

I think it's a bit too niche to warrant a dedicated literal type, but I hope the standard library will provide the cstr! macro eventually.

rilipco commented 9 months ago

Are there any plans to publish a new version (patch or minor) that just reexports the core types akin to the semver-trick? This would be quite beneficial when dealing with a dependency that uses this crate but should also inter-op with the new core types (particularly &CStr).

I guess the alternative would be to port those crates from cstr_core to core, which however would be a breaking change.

Amanieu commented 9 months ago

I'm happy to accept a PR for that. Now that c"" is stable and CStr is in core, there is no longer any reason to maintain this crate.