Struct parse_zoneinfo::line::Rule

source ·
pub struct Rule<'a> {
    pub name: &'a str,
    pub from_year: Year,
    pub to_year: Option<Year>,
    pub month: Month,
    pub day: DaySpec,
    pub time: TimeSpecAndType,
    pub time_to_add: TimeSpec,
    pub letters: Option<&'a str>,
}
Expand description

A rule definition line.

According to the zic(8) man page, a rule line has this form, along with an example:

    Rule  NAME  FROM  TO    TYPE  IN   ON       AT    SAVE  LETTER/S
    Rule  US    1967  1973  ‐     Apr  lastSun  2:00  1:00  D

Apart from the opening Rule to specify which kind of line this is, and the type column, every column in the line has a field in this struct.

Fields§

§name: &'a str

The name of the set of rules that this rule is part of.

§from_year: Year

The first year in which the rule applies.

§to_year: Option<Year>

The final year, or None if’s ‘only’.

§month: Month

The month in which the rule takes effect.

§day: DaySpec

The day on which the rule takes effect.

§time: TimeSpecAndType

The time of day at which the rule takes effect.

§time_to_add: TimeSpec

The amount of time to be added when the rule is in effect.

§letters: Option<&'a str>

The variable part of time zone abbreviations to be used when this rule is in effect, if any.

Trait Implementations§

source§

impl<'a> Clone for Rule<'a>

source§

fn clone(&self) -> Rule<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Rule<'a>

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<'a> PartialEq for Rule<'a>

source§

fn eq(&self, other: &Rule<'a>) -> 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<'a> Copy for Rule<'a>

source§

impl<'a> StructuralPartialEq for Rule<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Rule<'a>

§

impl<'a> RefUnwindSafe for Rule<'a>

§

impl<'a> Send for Rule<'a>

§

impl<'a> Sync for Rule<'a>

§

impl<'a> Unpin for Rule<'a>

§

impl<'a> UnwindSafe for Rule<'a>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.