In Rust 1.77.0, C-string literals have been stabilized and can be created with c"foo".
As such, using CStrs are easy to create, and I believe we should aim to be as zero-cost as possible when it comes to our bindings.
- Applying
format_compact! to a str is a non-zero cost operation, even if the str is small.
- My intuition tells be 90% of the time when using
&'a str, 'a is 'static.
This would also allow us to unify the APIs that have two functions: one that takes a &str and one that takes a &CStr. There are many functions
that do not even have a c_str equivalent, and this is personally an issue for me.
I also am slightly against the idea of using generics to accept CStr and str. Again, this will make newcomers more likely to use the much less efficient &str everywhere
when it makes no sense to do so.
In Rust 1.77.0, C-string literals have been stabilized and can be created with
c"foo".As such, using CStrs are easy to create, and I believe we should aim to be as zero-cost as possible when it comes to our bindings.
format_compact!to astris a non-zero cost operation, even if the str is small.&'a str,'ais'static.This would also allow us to unify the APIs that have two functions: one that takes a
&strand one that takes a&CStr. There are many functionsthat do not even have a
c_strequivalent, and this is personally an issue for me.I also am slightly against the idea of using generics to accept CStr and str. Again, this will make newcomers more likely to use the much less efficient
&streverywherewhen it makes no sense to do so.