pub fn serialize<S, T>(
    elements: &[T],
    serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
    T: Serialize,
Expand description

If you don’t want to use the ShortVec newtype, you can do ShortVec serialization on an ordinary vector with the following field annotation:

#[serde(with = “short_vec”)]