|
|
|
|
|
by nabeelms
1027 days ago
|
|
About String::leak: > The caller has free choice over the returned lifetime, including 'static. Indeed, this function is ideally used for data that lives for the remainder of the program’s life, as dropping the returned reference will cause a memory leak. I can see the use case of the function and from reading the commit discussion, it seems it was based on Vec::<u8>::leak() but I'm not able to understand why either of the functions are safe instead of unsafe. |
|
https://doc.rust-lang.org/book/ch15-06-reference-cycles.html