plist

Macro plist 

Source
macro_rules! plist {
    (dict { $($tt:tt)+ }) => { ... };
    (value { $($tt:tt)+ }) => { ... };
    (array [ $($tt:tt)+ ]) => { ... };
    ($($plist:tt)+) => { ... };
}
Expand description

Construct a plist::Value from a JSON-like literal.

let value = plist!({
    "code": 200,
    "success": true,
    "payload": {
        "features": [
            "serde",
            "plist"
        ],
        "homepage": null
    }
});

Variables or expressions can be interpolated into the plist literal. Any type interpolated into an array element or object value must implement Into<plist::Value>. If the conversion fails, the plist! macro will panic.

let code = 200;
let features = vec!["serde", "plist"];

let value = plist!({
    "code": code,
    "success": code == 200,
    "payload": {
        features[0]: features[1]
    }
});

Trailing commas are allowed inside both arrays and objects.

let value = plist!([
    "notice",
    "the",
    "trailing",
    "comma -->",
]);