3 stable releases

1.0.2 Jun 26, 2019

#1399 in Rust patterns

Download history 586/week @ 2024-01-04 726/week @ 2024-01-11 656/week @ 2024-01-18 643/week @ 2024-01-25 687/week @ 2024-02-01 903/week @ 2024-02-08 845/week @ 2024-02-15 861/week @ 2024-02-22 853/week @ 2024-02-29 930/week @ 2024-03-07 1205/week @ 2024-03-14 1416/week @ 2024-03-21 1281/week @ 2024-03-28 1296/week @ 2024-04-04 1041/week @ 2024-04-11 958/week @ 2024-04-18

4,806 downloads per month
Used in 6 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