[rust-dev] strings, slices and nulls

Niko Matsakis niko at alum.mit.edu
Wed Apr 18 12:43:40 PDT 2012

On 4/18/12 12:17 PM, Brian Anderson wrote:
> I would kind of like for Rust strings not to expose the fact that they 
> are null-terminated (or just not be null terminated) but it seems 
> unavoidable. 


I can see the practicality of null-terminating, but I would really like 
to preserve the flexibility to reverse that decision in the future. 
Forcing people to go through str::as_bytes() to observe the null 
terminating seems like a win—except that I'd probably call it as_cstr() 
or something like that, to emphasize it's null-terminated-ness.


More information about the Rust-dev mailing list