Struct parse_zoneinfo::table::RuleInfo

source ·
pub struct RuleInfo {
    pub from_year: Year,
    pub to_year: Option<Year>,
    pub month: Month,
    pub day: DaySpec,
    pub time: i64,
    pub time_type: TimeType,
    pub time_to_add: i64,
    pub letters: Option<String>,
}
Expand description

An owned rule definition line.

This mimics the Rule struct in the line module, only its uses owned Strings instead of string slices, and has had some pre-processing applied to it.

Fields§

§from_year: Year

The year that this rule starts applying.

§to_year: Option<Year>

The year that this rule finishes applying, inclusive, or None if it applies up until the end of this timespan.

§month: Month

The month it applies on.

§day: DaySpec

The day it applies on.

§time: i64

The exact time it applies on.

§time_type: TimeType

The type of time that time is.

§time_to_add: i64

The amount of time to save.

§letters: Option<String>

Any extra letters that should be added to this time zone’s abbreviation, in place of %s.

Implementations§

source§

impl RuleInfo

source

pub fn applies_to_year(&self, year: i64) -> bool

Returns whether this rule is in effect during the given year.

source

pub fn absolute_datetime( &self, year: i64, utc_offset: i64, dst_offset: i64 ) -> i64

Trait Implementations§

source§

impl Debug for RuleInfo

source§

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

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

impl<'line> From<Rule<'line>> for RuleInfo

source§

fn from(info: Rule<'_>) -> RuleInfo

Converts to this type from the input type.
source§

impl PartialEq for RuleInfo

source§

fn eq(&self, other: &RuleInfo) -> 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 StructuralPartialEq for RuleInfo

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where 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 T
where 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.