macro_rules! with_settings {
    ({$($k:ident => $v:expr),*$(,)?}, $body:block) => { ... };
}
Expand description

Settings configuration macro.

This macro lets you bind some Settings temporarily. The first argument takes key value pairs that should be set, the second is the block to execute. All settings can be set (sort_maps => value maps to set_sort_maps(value)). The exception are redactions which can only be set to a vector this way.

This example:

insta::with_settings!({sort_maps => true}, {
    // run snapshot test here
});

Is equivalent to the following:

let mut settings = Settings::new();
settings.set_sort_maps(true);
settings.bind(|| {
    // run snapshot test here
});