4 ms·
The equivalent C needs a second const -- your first one refers to the data behind the string but not the string pointer, and is more like Rust's `let usage: &st
by dtolnay 9y ago
The equivalent C needs a second const -- your first one refers to the data behind the string but not the string pointer, and is more like Rust's `let usage: &str`.
const char * const USAGE = "usage: blah blah";
- crzwdjk 9y agoOr rather `let mut usage: &str`. Rust actually is kind of similar to C here in that the pointer and pointee can be separately const or mutable. But in Rust "const" is the default and mut needing to be explicitly declared, whereas with C it's the other way around.