| 1 | struct AttrsWithEscapedStringArgs { |
| 2 | dollar string @[foo: '\$var'] |
| 3 | double_bs string @[bar: '\\baz'] |
| 4 | } |
| 5 | |
| 6 | @[deprecated: 'use bar() instead'] |
| 7 | @[foo: bar] |
| 8 | @[if debug; inline] |
| 9 | fn keep_attributes() { |
| 10 | println('hi !') |
| 11 | } |
| 12 | |
| 13 | @[bar: 'foo'] |
| 14 | fn attr_with_arg() {} |
| 15 | |
| 16 | @['a_string_name'] |
| 17 | fn name_only_attr() {} |
| 18 | |
| 19 | struct User { |
| 20 | age int |
| 21 | nums []int |
| 22 | last_name string @[json: lastName] |
| 23 | is_registered bool @[json: IsRegistered] |
| 24 | typ int @[json: 'type'] |
| 25 | pets string @[json: 'pet_animals'; raw] |
| 26 | } |
| 27 | |
| 28 | @[_allow_multiple_values] |
| 29 | enum Example { |
| 30 | value1 = 1 |
| 31 | value1_again = 1 |
| 32 | } |
| 33 | |
| 34 | @[deprecated: 'use Example instead'] |
| 35 | @[deprecated_after: '2040-01-24'] |
| 36 | pub type Alias = Example |
| 37 | |