Function definitions
Functions can be defined through the use of the def keyword, as with other symbol types, such as interfaces, unions, and enums, they can be marked as public through the use of the prepended pub.
The syntax for function definitions is as follows:
Type arguments can also be passed to functions, these are called monomorphizable or "generic" functions, for example:
To prevent strange type-errors from arising during compilation due to a programmer misunderstanding what a generic function allows, type arguments can be constrained like so:
In the above case, the type argument T is constrained to f32, f64, i32, and i64. Attempting to pass something other than that to T will result in a cleaner compile-time error.