Function ordered_optional_hashset

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

Serializes an Override<HashSet<V>> as Override<Vec<V>>.

Converts value to an Override<Vec<V>> and calls Vec::sort_unstable on it. This is necessary to guarantee idempotent ordering in the serialized output.

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

ยงErrors

Returns an error if serializing the Override<Vec<V>> fails.