Expand description
Big S — Rust’s missing String literal
Hey. Sometimes we need a String but all we have is a string literal (an
&'static str). I mean, I think we’ve all seen eye-searing code filled with
"this".to_string(), "that".to_owned(), or String::from("theother").
OMG somebody just do something about it.
Introducing S, the three-char solution to Rust’s stupidest papercut.
Check it out:
do_something_lame("this".to_string(), "that".to_string(), "theother".to_string());🙄
use big_s::S;
// RADICAL!
do_something_rad(S("this"), S("that"), S("theother"));👍
Functions§
- S
- Turn an
&'static strinto aString