Skip to main content

hash_with_options

Function hash_with_options 

Source
pub fn hash_with_options(value: &Value, options: Options) -> String
Expand description

The digest of a value with chosen options, as lowercase hexadecimal SHA-1.

ยงExample

use object_hash::{Options, Value, hash_with_options};

let object = Value::Object(vec![("a".into(), Value::number(1))]);
// A plain object and a map with the same entry hash differently, which is
// the reference's behaviour and the reason both cases exist.
let map = Value::Map(vec![("a".into(), Value::number(1))]);
assert_ne!(hash_with_options(&object, Options::default()), hash_with_options(&map, Options::default()));