#[repr(u8)]
pub enum SolarDay {
Show 31 variants First = 1, Second = 2, Third = 3, Fourth = 4, Fifth = 5, Sixth = 6, Seventh = 7, Eighth = 8, Ninth = 9, Tenth = 10, Eleventh = 11, Twelfth = 12, Thirteen = 13, Fourteen = 14, Fifteen = 15, Sixteen = 16, Seventeen = 17, Eighteen = 18, Nineteen = 19, Twenty = 20, TwentyFirst = 21, TwentySecond = 22, TwentyThird = 23, TwentyFourth = 24, TwentyFifth = 25, TwentySixth = 26, TwentySeventh = 27, TwentyEighth = 28, TwentyNinth = 29, Thirty = 30, ThirtyFirst = 31,
}
Expand description

列舉西曆三十一個天數名稱:一、二、…、十一、十二、…、二十一、二十二、…、三十、三十一。

Variants§

§

First = 1

§

Second = 2

§

Third = 3

§

Fourth = 4

§

Fifth = 5

§

Sixth = 6

§

Seventh = 7

§

Eighth = 8

§

Ninth = 9

§

Tenth = 10

§

Eleventh = 11

十一

§

Twelfth = 12

十二

§

Thirteen = 13

十三

§

Fourteen = 14

十四

§

Fifteen = 15

十五

§

Sixteen = 16

十六

§

Seventeen = 17

十七

§

Eighteen = 18

十八

§

Nineteen = 19

十九

§

Twenty = 20

二十

§

TwentyFirst = 21

二十一

§

TwentySecond = 22

二十二

§

TwentyThird = 23

二十三

§

TwentyFourth = 24

二十四

§

TwentyFifth = 25

二十五

§

TwentySixth = 26

二十六

§

TwentySeventh = 27

二十七

§

TwentyEighth = 28

二十八

§

TwentyNinth = 29

二十九

§

Thirty = 30

三十

§

ThirtyFirst = 31

三十一

Implementations§

source§

impl SolarDay

用以解析字串的關聯函數。

source

pub fn parse_str<S: AsRef<str>>(s: S) -> Result<Self, SolarDayError>

透過西曆日期字串來取得 SolarDay 列舉實體。

Examples
assert_eq!(SolarDay::Fifteen, SolarDay::parse_str("十五").unwrap());
source§

impl SolarDay

source

pub const unsafe fn from_u8_unsafe(number: u8) -> Self

透過西曆日期數值來取得 SolarDay 列舉實體。

Safety

必須先確認傳入的整數是合法的。

source

pub const fn to_u8(&self) -> u8

取得 SolarDay 列舉實體所代表的西曆日期字串。

source§

impl SolarDay

用以建立 SolarDay 列舉實體的關聯函數。

source

pub const fn from_u8(day: u8) -> Result<Self, SolarDayError>

透過西曆日期數值來取得 SolarDay 列舉實體。

Examples
let solar_day = SolarDay::from_u8(5).unwrap();
source

pub const fn from_u32(day: u32) -> Result<Self, SolarDayError>

透過西曆日期數值來取得 SolarDay 列舉實體。

Examples
let solar_day = SolarDay::from_u32(5).unwrap();
source§

impl SolarDay

SolarDay 列舉實體轉成其它型別的方法。

source

pub const fn to_str(self) -> &'static str

取得 SolarDay 列舉實體所代表的西曆日期字串。

Examples
assert_eq!("十五", SolarDay::Fifteen.to_str());
source

pub const fn to_u32(self) -> u32

取得 SolarDay 列舉實體所代表的西曆日期字串。

Trait Implementations§

source§

impl AsRef<str> for SolarDay

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for SolarDay

source§

fn clone(&self) -> SolarDay

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SolarDay

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for SolarDay

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.

Examples
assert_eq!("十五", format!("{}", SolarDay::Fifteen));
source§

impl From<SolarDate> for SolarDay

source§

fn from(value: SolarDate) -> Self

Converts to this type from the input type.
source§

impl From<SolarDay> for u32

source§

fn from(value: SolarDay) -> Self

Converts to this type from the input type.
source§

impl From<SolarDay> for u8

source§

fn from(value: SolarDay) -> Self

Converts to this type from the input type.
source§

impl FromStr for SolarDay

§

type Err = SolarDayError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for SolarDay

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for SolarDay

source§

fn cmp(&self, other: &SolarDay) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for SolarDay

source§

fn eq(&self, other: &SolarDay) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for SolarDay

source§

fn partial_cmp(&self, other: &SolarDay) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<u32> for SolarDay

§

type Error = SolarDayError

The type returned in the event of a conversion error.
source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<u8> for SolarDay

§

type Error = SolarDayError

The type returned in the event of a conversion error.
source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for SolarDay

source§

impl Eq for SolarDay

source§

impl StructuralEq for SolarDay

source§

impl StructuralPartialEq for SolarDay

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.