Cell & OnceCell
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Cell<T> lejon të ndryshosh një vlerë të vogël (Copy) edhe përmes një reference &. OnceCell dhe OnceLock e vendosin një vlerë vetëm një herë — ideale për konfigurim global të ngarkuar me vonesë.
EnglishEN
Cell<T> lets you change a small (Copy) value even through an & reference. OnceCell and OnceLock set a value only once — ideal for lazily loaded global configuration.
Si ta mendosh
Si një kuti që mbushet vetëm herën e parë që e hap.
Lexoje në anglisht
Like a box that fills itself only the first time you open it.
Shembull kodirust
static KONFIG: OnceLock<String> = OnceLock::new();
let k = KONFIG.get_or_init(|| String::from("sq"));