9.5 Unit-Like Structs

Unit-like structs are structs with no fields. They are primarily used to implement traits or act as markers.

9.5.1 Defining Unit-Like Structs

#![allow(unused)]
fn main() {
struct UnitStruct;
}

9.5.2 Using Unit-Like Structs

Although they carry no data, unit-like structs can still be instantiated.

let unit = UnitStruct;