| Section | Title |
|---|---|
| 1 | Generic Functions |
| 2 | Generic Structs |
| 3 | Type Constraints by Use |
| 4 | Interfaces by Convention |
| 5 | Compile-Time Dispatch |
| 6 | Exercises |
Generic FunctionsA function in Zig can take types as parameters.
Generic StructsA generic struct is a function that returns a type.
Type Constraints by UseZig does not have a formal trait or interface system.
Interfaces by ConventionZig has no built-in interface keyword.
Compile-Time DispatchGeneric functions in Zig are specialized at compile time.
ExercisesExercise 11-1. Write a generic min function for values that support <.