mangadex-api-types-rust 1.0.1

Types for mangadex-api
Documentation
use serde::{Deserialize, Serialize};

/// "Order by" directions for manga results.
#[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, Eq, Serialize)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
#[cfg_attr(feature = "async-graphql", derive(async_graphql::Enum))]
#[non_exhaustive]
pub enum OrderDirection {
    #[serde(rename = "asc")]
    Ascending,
    #[serde(rename = "desc")]
    Descending,
}

impl std::fmt::Display for OrderDirection {
    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
        fmt.write_str(match self {
            Self::Ascending => "asc",
            Self::Descending => "desc",
        })
    }
}