cargo serde_derive 1.0.108

latest releases: 1.0.144, 1.0.143, 1.0.142...
4 years ago
  • Provide a Serializer impl that can write primitives and unit variants to a &mut fmt::Formatter (#1705, thanks @jethrogb)

    use serde::Serialize;
    use std::fmt::{self, Display};
    
    #[derive(Serialize)]
    #[serde(rename_all = "kebab-case")]
    pub enum MessageType {
        StartRequest,
        EndRequest,
    }
    
    impl Display for MessageType {
        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
            self.serialize(f)
        }
    }

Don't miss a new serde_derive release

NewReleases is sending notifications on new releases.