kw inline
Contextual keyword — before for (§15.1)
The list of words: §1.4
Syntax
For = [ Label ":" ] [ "inline" ] "for" [ "await" ] Pattern "in" Expr [ "where" Expr ] Block ;Grammar: App. A
Defined in
- 1.4 Keywords — Reserved (cannot be used as names)
- 15.1 comptime — A comptime fn is executed only at compile time; comptime { …
- 15.2 Reflection — reflect(T) -> TypeInfo (comptime only)
Examples
comptime fn toCsvRow<T>(x: &T) -> String {
var out = String.new()
inline for f in reflect(T).fields where f.visible {
out.push("{x.[f]},")
}
out
}