Classes | |
| struct | StarSignBoundary |
| One row of the star-sign table. More... | |
| struct | StarSignData |
| The element data produced by every star-sign example. More... | |
Functions | |
| pub fn | star_sign_for (boundaries:&[StarSignBoundary], month:u32, day:u32,) -> Option<&'static str > |
Determine the star sign for a (month, day), searching the supplied boundaries. | |
| pub fn | parse_day_month (date:&str) -> Option<(u32, u32)> |
Parse a dd/mm/yyyy (or dd/mm) date string into a (month, day) pair. | |
| pub struct StarSignData | new () -> Self |
| Create an empty star-sign data. | |
Variables | |
| pub const | STAR_SIGN_DATA_KEY |
The data key the star-sign element stores its data under, "starsign". | |
| pub const | STAR_SIGN_PROPERTY |
| The property name holding the computed sign. | |
| pub const | DOB_JAVASCRIPT_PROPERTY |
| The property name holding the JavaScript that gathers the birth date on the client, used only by the client-side example. | |
| pub const | UNKNOWN_STAR_SIGN |
The marker returned when no sign could be determined, "Unknown". | |
| pub struct StarSignBoundary | StarSignBoundary |
| The twelve star signs with their date boundaries. | |
| inner | __pad0__ |
| pub fn set_star_sign | mut |
| Set the computed star sign. | |
Function Documentation
◆ new()
| pub struct StarSignData new | ( | ) | -> Self |
Create an empty star-sign data.
◆ parse_day_month()
| pub fn parse_day_month | ( | date:& | str | ) | -> Option<(u32, u32)> |
Parse a dd/mm/yyyy (or dd/mm) date string into a (month, day) pair.
The client-side example gathers the birth date as a slash-separated string from a cookie, so this accepts that format. Only the month and day are needed, but a trailing year is tolerated. Returns None if the string is not two or three numeric, slash-separated fields.
◆ star_sign_for()
| pub fn star_sign_for | ( | boundaries:& | [StarSignBoundary], |
| month:u32 | , | ||
| day:u32 | ) -> Option<& 'static str > |
Determine the star sign for a (month, day), searching the supplied boundaries.
This is the shared lookup the bins call once they have parsed a birth date, whether the boundaries came from the hard-coded [STAR_SIGNS] table or were read from an on-premise data file. It uses a strict month-and-day comparison and returns None when no sign matches (the caller then stores [UNKNOWN_STAR_SIGN]).
Variable Documentation
◆ __pad0__
| inner __pad0__ |
◆ DOB_JAVASCRIPT_PROPERTY
| pub const DOB_JAVASCRIPT_PROPERTY |
The property name holding the JavaScript that gathers the birth date on the client, used only by the client-side example.
◆ mut
| pub fn set_dob_javascript mut |
Set the computed star sign.
Set the client-side JavaScript that gathers the birth date.
Stored as a [PropertyValue::JavaScript] so the JavaScript builder element bundles it for execution on the client.
◆ STAR_SIGN_DATA_KEY
| pub const STAR_SIGN_DATA_KEY |
The data key the star-sign element stores its data under, "starsign".
◆ STAR_SIGN_PROPERTY
| pub const STAR_SIGN_PROPERTY |
The property name holding the computed sign.
◆ StarSignBoundary
| pub struct StarSignBoundary StarSignBoundary |
The twelve star signs with their date boundaries.
The comparison is strict on both ends, which leaves the boundary days themselves (and the year-wrapping Capricorn span) resolving to [UNKNOWN_STAR_SIGN]. This is preserved deliberately rather than silently "fixing" the astrology.
◆ UNKNOWN_STAR_SIGN
| pub const UNKNOWN_STAR_SIGN |
The marker returned when no sign could be determined, "Unknown".
