Function sort_object_params

Source
pub fn sort_object_params(
    params: &BTreeMap<String, Value>,
) -> BTreeMap<String, Value>
Expand description

Creates a sorted copy of a BTreeMap of parameters.

§Arguments

  • params - A reference to a BTreeMap containing string keys and Value values.

§Returns

A new BTreeMap with the same key-value pairs as the input, sorted by keys.

§Examples

let params = BTreeMap::from([ (“z".to_string(), Value::String("value1".to_string())), (”a".to_string(), Value::String("value2".to_string())), ]); let sorted_params = sort_object_params(&params); // sorted_params will have keys sorted in ascending order