| Crates.io | static-str |
| lib.rs | static-str |
| version | 0.2.0 |
| created_at | 2021-09-16 14:48:13.58768+00 |
| updated_at | 2022-02-18 06:32:09.030192+00 |
| description | convert a string into a static str |
| homepage | https://github.com/chanble/static-str |
| repository | https://github.com/chanble/static-str |
| max_upload_size | |
| id | 452293 |
| size | 2,983 |
how-to-convert-a-string-into-a-static-str
copy form here(how-to-convert-a-string-into-a-static-str)
cannot return reference to temporary value
use static_str::to_str;
fn main() {
let option_value = Some(123);
let v = option_value.map_or("", |v| to_str(v.to_string()));
assert_eq!(v, "123");
}