chinese-number 0.8.2

Convert primitive numbers to Chinese numbers, or parse Chinese numbers to primitive numbers.
Documentation
use enum_ordinalize::Ordinalize;

#[cfg(feature = "number-to-chinese")]
use crate::{ChineseCase, ChineseVariant};

#[derive(Debug, Copy, Clone, Eq, PartialEq, Ordinalize)]
#[ordinalize(impl_trait = false)]
#[ordinalize(ordinal(pub(crate) fn ordinal))]
#[ordinalize(from_ordinal_unsafe(pub(crate) fn from_ordinal_unsafe))]
#[allow(dead_code)]
#[repr(u8)]
pub(crate) enum ChineseNumber {,,,,,,,,,,,
}

impl ChineseNumber {
    #[cfg(feature = "number-to-chinese")]
    #[inline]
    pub(crate) const fn to_str(
        self,
        chinese_variant: ChineseVariant,
        chinese_case: ChineseCase,
    ) -> &'static str {
        match self {
            Self::=> "",
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => match chinese_variant {
                    ChineseVariant::Traditional => "",
                    ChineseVariant::Simple => "",
                },
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => match chinese_variant {
                    ChineseVariant::Traditional => "",
                    ChineseVariant::Simple => "",
                },
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => match chinese_variant {
                    ChineseVariant::Traditional => "",
                    ChineseVariant::Simple => "",
                },
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
        }
    }

    #[cfg(feature = "chinese-to-number")]
    #[inline]
    pub(crate) const fn from_char(character: char) -> Option<Self> {
        match character {
            '' | '0' | '' => Some(Self::),
            '' | '' | '1' => Some(Self::),
            '' | '' | '' | '' | '' | '' | '2' => Some(Self::),
            '' | '' | '' | '' | '' | '3' => Some(Self::),
            '' | '' | '4' => Some(Self::),
            '' | '' | '5' => Some(Self::),
            '' | '' | '' | '6' => Some(Self::),
            '' | '' | '7' => Some(Self::),
            '' | '' | '8' => Some(Self::),
            '' | '' | '9' => Some(Self::),
            '' | '' => Some(Self::),
            _ => None,
        }
    }
}

#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Ordinalize)]
#[ordinalize(impl_trait = false)]
#[ordinalize(ordinal(pub(crate) fn ordinal))]
#[ordinalize(from_ordinal_unsafe(pub(crate) fn from_ordinal_unsafe))]
#[allow(dead_code)]
#[repr(u8)]
pub(crate) enum ChineseExponent {,,,,,,,,,,,,,,,,,,
}

impl ChineseExponent {
    #[cfg(feature = "number-to-chinese")]
    #[inline]
    pub(crate) const fn to_str(
        self,
        chinese_variant: ChineseVariant,
        chinese_case: ChineseCase,
    ) -> &'static str {
        match self {
            Self::=> "",
            Self::=> "",
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_case {
                ChineseCase::Upper => "",
                ChineseCase::Lower => "",
            },
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "亿",
            },
            Self::=> "",
            Self::=> "",
            Self::=> "",
            Self::=> "",
            Self::=> "",
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
            Self::=> "",
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
        }
    }

    #[cfg(feature = "chinese-to-number")]
    #[inline]
    pub(crate) const fn from_char(character: char) -> Option<Self> {
        match character {
            '' => Some(Self::),
            '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '亿' => Some(Self::),
            '' => Some(Self::),
            '' => Some(Self::),
            '' => Some(Self::),
            '' => Some(Self::),
            '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            '' => Some(Self::),
            '' | '' => Some(Self::),
            '' | '' => Some(Self::),
            _ => None,
        }
    }
}

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[allow(dead_code)]
#[repr(u8)]
pub(crate) enum ChineseSign {,,
}

impl ChineseSign {
    #[cfg(feature = "number-to-chinese")]
    #[inline]
    pub(crate) const fn to_str(self, chinese_variant: ChineseVariant) -> &'static str {
        match self {
            Self::=> "",
            Self::=> match chinese_variant {
                ChineseVariant::Traditional => "",
                ChineseVariant::Simple => "",
            },
        }
    }

    #[cfg(feature = "chinese-to-number")]
    #[inline]
    pub(crate) const fn from_char(character: char) -> Option<Self> {
        match character {
            '' => Some(Self::),
            '' | '' => Some(Self::),
            _ => None,
        }
    }
}

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub(crate) struct ChinesePoint;

impl ChinesePoint {
    #[cfg(feature = "number-to-chinese")]
    #[inline]
    pub(crate) const fn to_str(chinese_variant: ChineseVariant) -> &'static str {
        match chinese_variant {
            ChineseVariant::Traditional => "",
            ChineseVariant::Simple => "",
        }
    }

    #[cfg(feature = "chinese-to-number")]
    #[inline]
    pub(crate) const fn from_char(character: char) -> Option<Self> {
        match character {
            '' | '' => Some(ChinesePoint),
            _ => None,
        }
    }
}