Function serde_tagged::ser::internal::serialize

source ·
pub fn serialize<S, T, V>(
    serializer: S,
    tag_key: &'static str,
    tag: &T,
    value: &V
) -> Result<S::Ok, S::Error>
where S: Serializer, T: Serialize + ?Sized, V: Serialize + ?Sized,
Expand description

Embeds a tag into the specified value and then serializes it using the provided serializer.

Due to the tag being embedded into the value, not all value-types are supported. The specified serializer performs the actual serialization and thus controls the data format. For more information on this trag-format and the supported values, see the module documentation.

This method is a convenience function that creates and uses the Serializer internally.

§Warning

This function does not provide any checks regarding collisions of the tag_key with field-names or map-keys. The responsibility for such checks reside with the caller.