| Crates.io | even_bigger_s |
| lib.rs | even_bigger_s |
| version | 1.0.0 |
| created_at | 2024-03-01 13:19:18.538175+00 |
| updated_at | 2024-03-01 13:19:18.538175+00 |
| description | Better String Literal |
| homepage | https://github.com/Adamska1008/even_bigger_s |
| repository | https://github.com/Adamska1008/even_bigger_s |
| max_upload_size | |
| id | 1158895 |
| size | 6,306 |
S: Better String LiteralEveryone is tired of typing "foo"._string() and String::from("bar") stuff. Maybe you've tried Big S, a helpful crate with only one funcion in one line. With "Big S" you can do this:
assert_eq!(S("foo"), "foo".to_string())
Cool, but things can be better, with Even Bigger S and also only one macro S.
S("")S!()S("foo")S!("foo")This one is new.
"foo".to_string() + "bar"S("foo") + "bar"S!("foo" "bar")If you want to separate strings with spaces, you can do:
assert_eq!(S!("hello", "world"), "hello world".to_string());
This one is especially helpful with an extensive string literal:
assert_eq!(
S!(
"Imagine how stupid it will be to include a very long paragraph literal in rust code.",
"With even bigger s, text has much more readability.",
"Have you ever seen a very very long String literal in your code?"
"Well, I have. I guess I won't see that any more.",
),
"Imagine how stupid it will be to include a very long paragraph literal in rust code. With even bigger s, text has much more readability. Have you ever seen a very very long String literal in your code? Well, I have. I guess I won't see that any more.".to_string()
)