Function ordered_hashset

Source
pub fn ordered_hashset<S, V: Serialize + Ord>(
    value: &HashSet<V>,
    serializer: S,
) -> Result<S::Ok, S::Error>
where S: Serializer,
Expand description

Serializes a HashSet as Vec.

Converts value to a Vec<T> and calls Vec::sort_unstable on it. This is necessary to guarantee idempotent ordering in serialized output.

We use sort_unstable, as we know that all elements are unique.

ยงErrors

Returns an error if serializing the Vec<T> fails.