https://github.com/brson/big_s
Rust's missing `String` literal
https://github.com/brson/big_s
Last synced: 10 months ago
JSON representation
Rust's missing `String` literal
- Host: GitHub
- URL: https://github.com/brson/big_s
- Owner: brson
- Created: 2019-06-26T02:34:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T02:57:15.000Z (about 7 years ago)
- Last Synced: 2024-04-24T00:44:10.035Z (about 2 years ago)
- Language: Rust
- Size: 1.95 KB
- Stars: 18
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```rust
do_something_lame("this".to_string(), "that".to_string(), "theother".to_string());
```
🙄
```rust
use big_s::S;
do_something_rad(S("this"), S("that"), S("theother"));
```
👍
## License
MIT/Apache-2.0/CC0-1.0