Function serde_yml::with::singleton_map::serialize

source ·
pub fn serialize<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
where T: Serialize, S: Serializer,
Expand description

Serializes a given value using a singleton map representation.

This function wraps the given value in a singleton map structure before serialization. The singleton map representation uses the enum variant name as the key and the variant value as the value.

§Arguments

  • value - A reference to the value to be serialized.
  • serializer - The serializer to use for serializing the value.

§Returns

A result containing the serialization output or an error in case of failure.