3 stable releases

1.0.2 Jun 26, 2019

#1298 in Rust patterns

Download history 796/week @ 2023-11-28 730/week @ 2023-12-05 761/week @ 2023-12-12 749/week @ 2023-12-19 527/week @ 2023-12-26 526/week @ 2024-01-02 702/week @ 2024-01-09 680/week @ 2024-01-16 649/week @ 2024-01-23 656/week @ 2024-01-30 794/week @ 2024-02-06 926/week @ 2024-02-13 869/week @ 2024-02-20 814/week @ 2024-02-27 819/week @ 2024-03-05 1084/week @ 2024-03-12

3,704 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