traduora 0.4.0

REST API bindings for Traduora, an open-source translation management platform
Documentation
macro_rules! impl_wrapper {
    ( $name:ident, $doc:expr$(,)? ) => {
        #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
        #[doc = $doc]
        pub struct $name(String);

        impl $name {
            /// Create a new id.
            pub fn new<T>(id: T) -> Self
            where
                T: Into<String>,
            {
                $name(id.into())
            }

            /// The value of the id.
            #[must_use]
            pub fn value(&self) -> &str {
                &self.0
            }
        }

        impl From<String> for $name {
            fn from(f: String) -> Self {
                Self(f)
            }
        }

        impl From<&str> for $name {
            fn from(f: &str) -> Self {
                Self(f.to_string())
            }
        }

        impl From<$name> for String {
            fn from(f: $name) -> Self {
                f.0
            }
        }

        impl std::fmt::Display for $name {
            fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
                write!(f, "{}", self.0)
            }
        }
    };
}