Visibility (pub, pub(crate))
Në shqip: Dukshmëria në Rust
ShpjegimiSQ
Në Rust, gjithçka është private si parazgjedhje. pub e bën publike, pub(crate) të dukshme vetëm brenda crate-it, pub(super) vetëm për modulin prind. Fushat e struct-it kanë dukshmërinë e tyre.
EnglishEN
In Rust, everything is private by default. pub makes it public, pub(crate) visible only inside the crate, pub(super) only to the parent module. Struct fields have their own visibility.
Si ta mendosh
Si dyert e një ndërtese: disa për publikun, disa vetëm për stafin.
Lexoje në anglisht
Like a building's doors: some for the public, some for staff only.
Shembull kodirust
pub struct Nxenes {
pub emri: String,
nota: u8, // private
}