4.9 Attributes
- Syntax:
@nameor@name(arguments)before a declaration, field, parameter orrpc. The order of attributes does not matter. - Attribute arguments are comptime expressions: literals,
consts, calls of comptime functions. Therefore@timeout(STD_TIMEOUT)is allowed and recommended (part IV). - Some attributes accept a lambda over the parameters (
@idempotent(key: r => r.cartId)) or a field path (@owner(.userId)); this is stated in the description of the attribute. - A user attribute:
attr Audit { level: Level = Level.Info }+ a comptime handler (§15.4).
Built-in attributes: @derive @sealed @explicit @open @error @reflect @since @removed @tag @v @codec @repr @table @pk @auto @index @shard @owner @visible @encrypted @public @allow @timeout @retry @deadline @cache @ratelimit @idempotent @resumable @trace @audit @idle @near @pinned @test_only @deprecated @inline @cold. The semantics of each is in the section where it is introduced; the summary table is in part II.
Related diagnostics
See also
Source: docs/spec/oxl-standard.en.md