Macro bson2::bson [−][src]
macro_rules! bson {
(@ array [$($elems : expr,) *]) => { ... };
(@ array [$($elems : expr), *]) => { ... };
(@ array [$($elems : expr,) *] null $($rest : tt) *) => { ... };
(@ array [$($elems : expr,) *] [$($array : tt) *] $($rest : tt) *) => { ... };
(@ array [$($elems : expr,) *] { $($map : tt) * } $($rest : tt) *) => { ... };
(@ array [$($elems : expr,) *] $next : expr, $($rest : tt) *) => { ... };
(@ array [$($elems : expr,) *] $last : expr) => { ... };
(@ array [$($elems : expr), *], $($rest : tt) *) => { ... };
(@ object $object : ident() () ()) => { ... };
(@ object $object : ident [$($key : tt) +] ($value : expr), $($rest : tt) *) => { ... };
(@ object $object : ident [$($key : tt) +] ($value : expr)) => { ... };
(@ object $object : ident($($key : tt) +) (: null $($rest : tt) *) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) +)
(: [$($array : tt) *] $($rest : tt) *) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) +)
(: { $($map : tt) * } $($rest : tt) *) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) +) (: $value : expr, $($rest : tt) *)
$copy : tt) => { ... };
(@ object $object : ident($($key : tt) +) (: $value : expr) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) +) (:) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) +) () $copy : tt) => { ... };
(@ object $object : ident() (: $($rest : tt) *)
($kv_separator : tt $($copy : tt) *)) => { ... };
(@ object $object : ident($($key : tt) *) (, $($rest : tt) *)
($comma : tt $($copy : tt) *)) => { ... };
(@ object $object : ident() (($key : expr) : $($rest : tt) *) $copy : tt) => { ... };
(@ object $object : ident($($key : tt) *) ($tt : tt $($rest : tt) *) $copy :
tt) => { ... };
(null) => { ... };
([]) => { ... };
([$($tt : tt) +]) => { ... };
({ }) => { ... };
({ $($tt : tt) + }) => { ... };
($other : expr) => { ... };
}
Expand description
Construct a bson::BSON value from a literal.
let value = bson!({
"code": 200,
"success": true,
"payload": {
"some": [
"pay",
"loads",
]
}
});