Tuple structs & unit structs
Në shqip: Struct-et tuple
ShpjegimiSQ
Një tuple struct ka fusha pa emër: struct Pika(i32, i32);. I dobishëm për mbështjellje të vogla (newtype). Një unit struct (struct Shenje;) s'ka fare fusha.
EnglishEN
A tuple struct has unnamed fields: struct Point(i32, i32);. Handy for small wrappers (newtype). A unit struct (struct Marker;) has no fields at all.
Si ta mendosh
Si një kuti me ndarje pa etiketa.
Lexoje në anglisht
Like a box with unlabelled compartments.
Shembull kodirust
struct Ngjyra(u8, u8, u8);
let e_kuqe = Ngjyra(255, 0, 0);
println!("{}", e_kuqe.0);