Skip to content

0.12.3

Compare
Choose a tag to compare
@maciejhirsz maciejhirsz released this 17 Mar 11:14
· 2 commits to master since this release
b99d38d
  • Improved macro syntax:
    • Object "key" => value pair can be now written as either "key": value or key: value without quotes, as long as key is an identifier.
    • If you want to use the value of the a variable as a key in the new notation, use [foo]: value.
    • When nesting objects or arrays, it's no longer necessary to use invoke array! or object! from within another macro.
    • null is a keyword inside of either macro.
    • This is a backwards compatible change, although mixing notations within a single macro invocation is not permitted.

Example

Instead of:

let obj = object! {
    "foo" => array![1, 2, json::Null],
    "bar" => 42
};

You can now write:

let obj = object! {
    foo: [1, 2, null],
    bar: 42
};