keyword
Rust 'static: describe a static lifetime or type bound
A reference with the static lifetime can remain valid for the duration of the program. A type bound T: static (written with the apostrophe) instead restricts the lifetimes contained in the type; it does not force a value to remain allocated forever. Expected output (not executed): Ready Why: The string literal has static storage duration. Common mistake: Do not use a static reference annotation to extend the lifetime of a local String.
Formal Syntax & Structure
rust syntaxrust
&'static T; T: 'staticWorking Example
Example Snippetrust
fn label() -> &'static str { "Ready" }
fn main() { let text = label(); println!("{text}");}