Y
Hacker News
new
|
ask
|
show
|
jobs
by
derkha
2953 days 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.
1 comments
C4K3
2953 days ago
Ah cool, I hadn't heard about Box::leak until now. Coming to stable in 1.26 it seems.
link