Building Types with @Type
Construct new types programmatically.
The Reverse of @typeInfo
If @typeInfo turns a type into data, @Type turns data back into a real type. Together they let you reshape types at compile time. 🛠️
Feed It a Type.Info Value
@Type takes a std.builtin.Type value and produces the concrete type it describes. You hand it a description, it gives you a type.
const T = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 8 } });All lessons in this course
- Reflecting Fields with @typeInfo
- Building Types with @Type
- Comptime Validation and @compileError
- Generating Code with comptime