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

vllm : Failed to infer device type

android studio kotlin source is null error

gemini cli getting file not defined error