Rust scalar and compound types, structs, impl blocks, traits, generics, trait objects and derive macros.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What is the default integer type in Rust?
Show answer
i32
- What numeric range does an i32 represent?
Show answer
-2147483648 to 2147483647
- Name Rust's two floating-point types.
Show answer
f32 and f64
- What type represents boolean values in Rust?
Show answer
bool
- How many bytes does a char type occupy?
Show answer
4 bytes
- What is the syntax for an array type holding 10 i32 elements?
Show answer
[i32; 10]
- How do you initialize an array with 5 copies of the value 3?
Show answer
[3; 5]
- What is a tuple?
Show answer
A fixed-size collection of values with possibly different types
- What syntax accesses the second element of a tuple?
Show answer
tuple.1
- What is the key difference between arrays and tuples?
Show answer
Arrays have uniform element types; tuples can mix types
- What is a struct?
Show answer
A composite data type that groups related values together with names
- Name all three kinds of structs in Rust.
Show answer
Named, tuple, and unit structs
- What is a named struct?
Show answer
A struct with explicitly named fields, defined with curly braces
- What is a tuple struct and how are its fields accessed?
Show answer
A struct with unnamed fields accessed by numeric position
- What is a unit struct used for?
Show answer
A struct with no fields, often used as a marker type