3 stable releases

1.0.2 Jun 26, 2019

#32 in #string-literal

Download history 321/week @ 2024-07-25 338/week @ 2024-08-01 394/week @ 2024-08-08 281/week @ 2024-08-15 306/week @ 2024-08-22 329/week @ 2024-08-29 286/week @ 2024-09-05 271/week @ 2024-09-12 320/week @ 2024-09-19 317/week @ 2024-09-26 373/week @ 2024-10-03 388/week @ 2024-10-10 392/week @ 2024-10-17 346/week @ 2024-10-24 398/week @ 2024-10-31 322/week @ 2024-11-07

1,506 downloads per month
Used in 7 crates

MIT/Apache-2.0/CC0-1.0

4KB

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;

do_something_rad(S("this"), S("that"), S("theother"));

👍

License

MIT/Apache-2.0/CC0-1.0


lib.rs:

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"));

👍

No runtime deps