2 ms·
You can convert a `String` into a `&'static str` using only safe stdlib functions via `Box::leak(s.into())`. This uses `unsafe` internally, of course... but so
by derkha 8y ago
You can convert a `String` into a `&'static str` using only safe stdlib functions via `Box::leak(s.into())`. This uses `unsafe` internally, of course... but so does almost any code.
- C4K3 8y agoAh cool, I hadn't heard about Box::leak until now. Coming to stable in 1.26 it seems.