pub struct Config {
pub year_divide: YearDivide,
pub horoscope_divide: HoroscopeDivide,
pub age_divide: AgeDivide,
pub day_divide: DayDivide,
pub algorithm: Algorithm,
pub astro_type: AstroType,
pub overrides: Option<Arc<TableOverrides>>,
}Expand description
排盘配置:控制分界点、算法派别与自定义表的全部开关
Fields§
§year_divide: YearDivide年分界点
horoscope_divide: HoroscopeDivide运限分界点
age_divide: AgeDivide虚岁分界点
day_divide: DayDivide晚子时归属
algorithm: Algorithm算法派别
astro_type: AstroType排盘视角(天盘/地盘/人盘)
overrides: Option<Arc<TableOverrides>>自定义四化与亮度表;None 表示全部使用默认表。
不参与序列化:它是排盘的输入配置,不属于排盘结果, 加入 DTO 会破坏与 JS iztro 的字段契约。
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_astro_type(self, astro_type: AstroType) -> Self
pub fn with_astro_type(self, astro_type: AstroType) -> Self
在当前配置上指定排盘视角。
Sourcepub fn with_mutagens(self, stem: HeavenlyStem, stars: [StarKey; 4]) -> Self
pub fn with_mutagens(self, stem: HeavenlyStem, stars: [StarKey; 4]) -> Self
在当前配置上覆盖某个天干的四化表。
Sourcepub fn with_brightness(
self,
star: StarKey,
table: [Option<Brightness>; 12],
) -> Self
pub fn with_brightness( self, star: StarKey, table: [Option<Brightness>; 12], ) -> Self
在当前配置上覆盖某颗星的十二宫亮度表。
Sourcepub fn mutagens_of(&self, stem: HeavenlyStem) -> [StarKey; 4]
pub fn mutagens_of(&self, stem: HeavenlyStem) -> [StarKey; 4]
该天干实际生效的四化表:有覆盖用覆盖,否则用默认表。
Sourcepub fn brightness_of(
&self,
star: StarKey,
palace_index: usize,
) -> Option<Brightness>
pub fn brightness_of( &self, star: StarKey, palace_index: usize, ) -> Option<Brightness>
该星在指定宫位实际生效的亮度:有覆盖用覆盖,否则用默认表。
palace_index 为盘上位置(寅宫为 0),越界会对 12 取模。
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more