Drop (RAII in Rust)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Kur një vlerë del nga blloku, Rust-i thërret vetë Drop-in e saj — vendi për të mbyllur skedarë ose lidhje. Është RAII-ja e C++, por e garantuar nga gjuha.
EnglishEN
When a value goes out of scope, Rust calls its Drop automatically — the place to close files or connections. It's C++'s RAII, guaranteed by the language.
Si ta mendosh
Si drita automatike që fiket vetë kur del nga dhoma.
Lexoje në anglisht
Like an automatic light that switches off when you leave the room.
Shembull kodirust
struct Lidhja;
impl Drop for Lidhja {
fn drop(&mut self) { println!("Lidhja u mbyll"); }
}