macro_rules! doc {
({}) => { ... };
() => { ... };
({ $($key:tt : $value:tt),* $(,)? }) => { ... };
($($key:tt : $value:tt),* $(,)?) => { ... };
}Expand description
Creates a Nitrite Document with JSON-like syntax.
ยงExamples
use nitrite::doc;
// Empty document
let empty = doc!{};
// Simple key-value pairs
let simple = doc!{
name: "Alice",
age: 30
};
// With expressions
let base = 100;
let with_expr = doc!{
name: "Bob",
score: (base * 2),
computed: (base + 50)
};
// Nested documents and arrays
let complex = doc!{
user: {
name: "Charlie",
tags: ["admin", "user"]
},
values: [1, 2, 3]
};