rust - &'static str

This is one of the WTF moments in rust. How am i going to remember to write a return type that looks like  &'static str 

To ensure my return string slice lasted forever and won't be garbage collected  deallocated. Yep, rust doesn't use garbage collector but instead it uses ownership to manage memory allocations


async fn root() -> &'static str {
    "Hello, World!"
}




Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm