pub struct Options {
pub exclude_values: bool,
pub unordered_arrays: bool,
pub unordered_sets: bool,
pub unordered_objects: bool,
}Expand description
The choices that change the canonical bytes, mirroring the reference’s options.
Options::default is what the reference does when nothing is passed, so a
digest computed with the default options matches one the reference computes
with no options.
The reference’s respectType is deliberately absent. It is on by default
there and makes every plain object carry a preamble describing Node’s
prototype chain, which is a fact about the JavaScript runtime rather than
about the value. This crate always encodes the respectType: false form; if
the other side hashes plain objects with the default, hash them as
Value::Map there or turn respectType off.
Fields§
§exclude_values: boolWrite only the keys of an object, ignoring the values.
This is the reference’s excludeValues, and its keys and keysMD5
helpers. It applies to Value::Object only; a Value::Map keeps its
values, as the reference’s does.
unordered_arrays: boolSort an array’s entries, so its order stops mattering.
This is the reference’s unorderedArrays, off by default.
unordered_sets: boolSort a set’s entries.
This is the reference’s unorderedSets, on by default, and the reason a
set is unordered at all.
unordered_objects: boolSort an object’s keys.
This is the reference’s unorderedObjects, on by default.