Skip to main content

with_json_parse_options

Function with_json_parse_options 

Source
pub fn with_json_parse_options<T>(
    opts: &JsonParseOptions,
    f: impl FnOnce() -> T,
) -> T
Available on crate features json and std only.
Expand description

Run a closure with the given parse options active.

The options affect enum deserialization within the closure. This is thread-local state — concurrent parses on different threads are independent. The previous options are restored when the closure returns (or panics), so scopes nest correctly.

This function is only available with the std feature. In no_std builds, use set_global_json_parse_options instead (see the module documentation for the usage contract).