pub struct ParseCfg {
pub parse: Option<Vec<String>>,
pub mode: Mode,
pub order: Order,
pub lang: Lang,
pub to_lower: bool,
pub relative: bool,
pub ref_time: Option<Dt>,
}Fields§
§parse: Option<Vec<String>>Explicit list of formats to try in the exact order given.
If this is provided and the vec is non-empty and the mode is Explicit
then only these formats are tried and mode and order are ignored.
If the mode is not Explicit then after trying the formats in parse the
rest of the parser will continue as normal, using mode and order.
Example:
parse: ["%Y-%m-%d", "%d/%m/%Y", "%m/%d/%Y", "%d.%m.%Y"]mode: ModeControls which preset format sets are used (astronomy/scientific formats, legacy business rules, etc.).
order: OrderControls ambiguous numeric dates.
lang: LangSets language to use, not persistent.
to_lower: boolWhether to lowercase the input:
ONLY set to false if the &str is already lowercase.
relative: boolWhether to parse relative dates as well as normal dates.
ref_time: Option<Dt>Reference (“current”) time used for relative expressions:
- “tomorrow”, “next Friday”, “in 3 days”, “next week”
- If
Some, thisDtis used as “now” (overrides everything). - If
None+stdfeature enabled: automatically uses real system time. - If
None+ nostd: parsing relative dates will fail with a clear error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ParseCfg
impl<'de> Deserialize<'de> for ParseCfg
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
Source§impl Tsify for ParseCfg
impl Tsify for ParseCfg
const DECL: &'static str = "export interface ParseCfg {\n /**\n * Explicit list of formats to try **in the exact order given**.\n *\n * If this is provided and the vec is non-empty and the mode is Explicit\n * then only these formats are tried and `mode` and `order` are ignored.\n *\n * If the mode is not Explicit then after trying the formats in parse the\n * rest of the parser will continue as normal, using `mode` and `order`.\n *\n * Example:\n * ```js\n * parse: [\\\"%Y-%m-%d\\\", \\\"%d/%m/%Y\\\", \\\"%m/%d/%Y\\\", \\\"%d.%m.%Y\\\"]\n * ```\n */\n parse?: string[] | null;\n /**\n * Controls which preset format sets are used (astronomy/scientific formats,\n * legacy business rules, etc.).\n */\n mode?: Mode;\n /**\n * Controls ambiguous numeric dates.\n */\n order?: Order;\n /**\n * Sets language to use, not persistent.\n */\n lang?: Lang;\n /**\n * Whether to lowercase the input:\n * ONLY set to `false` if the &str is already lowercase.\n */\n to_lower?: boolean;\n /**\n * Whether to parse relative dates as well as normal dates.\n */\n relative?: boolean;\n /**\n * **Reference (\\\"current\\\") time** used for relative expressions:\n * - \\\"tomorrow\\\", \\\"next Friday\\\", \\\"in 3 days\\\", \\\"next week\\\n * - If `Some`, this `Dt` is used as \\\"now\\\" (overrides everything).\n * - If `None` + `std` feature enabled: automatically uses real system time.\n * - If `None` + no `std`: parsing relative dates will fail with a clear error.\n */\n ref_time?: Dt | null;\n}"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
impl StructuralPartialEq for ParseCfg
Auto Trait Implementations§
impl Freeze for ParseCfg
impl RefUnwindSafe for ParseCfg
impl Send for ParseCfg
impl Sync for ParseCfg
impl Unpin for ParseCfg
impl UnsafeUnpin for ParseCfg
impl UnwindSafe for ParseCfg
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