Tour di Rust Indice dei Contenuti

[Non tradotto] Static Lifetimes

A static variable is a memory resource created at compile-time that exists through a program start to finish. They must have their types explicitly specified.

A static lifetime is a memory resource that lasts indefinitely to the end of a program. Note that by this definition some static lifetime resources can be created at runtime.

Resources with static lifetimes have a special lifetime specifier 'static.

'static resources will never drop.

If static lifetime resources contain references they must all be 'static (anything less would not live long enough).

Memory detail: