pub struct FastComponents { /* private fields */ }Expand description
Fast, stack-allocated date/time components
This is the optimized replacement for HashMap-based ParsedComponents. Total size: 10 * 4 (values) + 2 (known) + 2 (implied) = 44 bytes
Implementations§
Source§impl FastComponents
impl FastComponents
Sourcepub const fn new() -> FastComponents
pub const fn new() -> FastComponents
Create new empty components
Sourcepub fn with_defaults(reference: &ReferenceWithTimezone) -> FastComponents
pub fn with_defaults(reference: &ReferenceWithTimezone) -> FastComponents
Create components with default implied values from a reference date
Sourcepub fn is_certain(&self, comp: Component) -> bool
pub fn is_certain(&self, comp: Component) -> bool
Check if a component is certain (known)
Sourcepub fn has(&self, comp: Component) -> bool
pub fn has(&self, comp: Component) -> bool
Check if a component has any value (known or implied)
Sourcepub fn assign(&mut self, comp: Component, value: i32) -> &mut FastComponents
pub fn assign(&mut self, comp: Component, value: i32) -> &mut FastComponents
Assign a value to a component (makes it certain/known)
Sourcepub fn imply(&mut self, comp: Component, value: i32) -> &mut FastComponents
pub fn imply(&mut self, comp: Component, value: i32) -> &mut FastComponents
Imply a value for a component (only if not already known)
Sourcepub fn delete(&mut self, comp: Component) -> &mut FastComponents
pub fn delete(&mut self, comp: Component) -> &mut FastComponents
Delete a component (remove from both known and implied)
Sourcepub fn is_only_date(&self) -> bool
pub fn is_only_date(&self) -> bool
Check if only date components are certain (no time)
Sourcepub fn is_only_time(&self) -> bool
pub fn is_only_time(&self) -> bool
Check if only time components are certain (no date)
Sourcepub fn is_only_weekday_component(&self) -> bool
pub fn is_only_weekday_component(&self) -> bool
Check if only weekday is certain
Sourcepub fn is_date_with_unknown_year(&self) -> bool
pub fn is_date_with_unknown_year(&self) -> bool
Check if date has unknown year
Sourcepub fn get_certain_components(&self) -> Vec<Component>
pub fn get_certain_components(&self) -> Vec<Component>
Get all certain components as a list
Sourcepub fn is_valid_date(&self) -> bool
pub fn is_valid_date(&self) -> bool
Check if the date components are valid
Sourcepub fn to_datetime(
&self,
reference: &ReferenceWithTimezone,
) -> Option<DateTime<Local>>
pub fn to_datetime( &self, reference: &ReferenceWithTimezone, ) -> Option<DateTime<Local>>
Convert to a chrono DateTime
Trait Implementations§
Source§impl Clone for FastComponents
impl Clone for FastComponents
Source§fn clone(&self) -> FastComponents
fn clone(&self) -> FastComponents
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more