kw attr
Reserved keyword
The list of words: §1.4
Syntax
AttrDecl = "attr" Ident "{" { Field } "}" ;Grammar: App. A
Defined in
- 15.4 User-defined attributes and code generation — attr Name { fields } declares an attribute; comptime fn Name.apply(d
- 4.9 Attributes — Syntax: @name or @name(arguments) before a declaration, field, parameter or rpc.
- 10.2 rpc attributes — Defaults for all rpcs are set in cluster { defaults { …
- 1.4 Keywords — Reserved (cannot be used as names)
- 9.4 Decoding and validation — A missing required field → DecodeError.Missing.
Examples
attr Audit { level: Level = Level.Info }
comptime fn Audit.apply(d: Decl, a: Audit) -> Decl | CompileError {
d.wrapBody(body => quote { log.at($a.level, "call {$d.name}"); $body })
}— 15.4 User-defined attributes and code generation
Related diagnostics
deprecated, attribute-not-applicable, cache-not-readonly, invalid-window, retry-not-idempotent, rpc-attr