fuchsia_inspect_contrib

Macro make_inspect_loggable

Source
macro_rules! make_inspect_loggable {
    ($($args:tt)+) => { ... };
}
Expand description

Convenience macro to construct a closure that implements WriteInspect, so it can be used in inspect_log! and inspect_insert!.

Note that this macro constructs a move closure underneath, unlike inspect_log! and inspect_insert! where variables are only borrowed.

Example 1:

let bounded_list_node = ...;
let obj = make_inspect_loggable!(k1: "1", k2: 2i64, k3: "3");
inspect_log!(bounded_list_node, some_key: obj);

Example 2

let bounded_list_node = ...;
let point = Some((10, 50));
inspect_log!(bounded_list_node, point?: point.map(|(x, y)| make_inspect_loggable!({
    x: x,
    y: y,
})))