Crates.io | big_s |
lib.rs | big_s |
version | 1.0.2 |
source | src |
created_at | 2019-06-26 02:54:02.291647 |
updated_at | 2019-06-26 02:57:21.343617 |
description | Rust's missing `String` literal |
homepage | https://github.com/brson/big_s |
repository | https://github.com/brson/big_s |
max_upload_size | |
id | 143642 |
size | 3,151 |
S
— Rust's missing String
literalHey. 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;
do_something_rad(S("this"), S("that"), S("theother"));
👍
MIT/Apache-2.0/CC0-1.0