[][src]Struct sunrise_libtimezone::TimeZoneRule

#[repr(C, align(8))]pub struct TimeZoneRule {
    pub(crate) timecnt: i32,
    pub(crate) typecnt: i32,
    pub(crate) charcnt: i32,
    pub(crate) goback: bool,
    pub(crate) goahead: bool,
    pub(crate) ats: [Time; 1000],
    pub(crate) types: [u8; 1000],
    pub(crate) ttis: [TimeTypeInfo; 128],
    pub(crate) chars: [u8; 512],
    pub(crate) default_type: i32,
    reserved: [u8; 4804],
}

Represent the rules defining a TimeZone.

Fields

timecnt: i32

The count of time transitions.

typecnt: i32

The count of time type infos.

charcnt: i32

The count of chars.

goback: bool

Used to control the rule that should apply when a specified time is out of any rules in the past.

goahead: bool

Used to control the rule that should apply when a specified time is out of any rules in the future.

ats: [Time; 1000]

Time transition timepoints.

types: [u8; 1000]

Time transition types.

ttis: [TimeTypeInfo; 128]

Time type infos.

chars: [u8; 512]

The chars.

default_type: i32

The index of the default type (usually zero).

reserved: [u8; 4804]

Reserved / Unused space.

Implementations

impl TimeZoneRule[src]

pub fn from_bytes(buffer: &[u8]) -> &Self[src]

Load the given timezones rules from a given slice contains an actual TimeZoneRule.

Panic:

This function panic if the given buffer is either too short or not aligned

pub fn from_mut_bytes(buffer: &mut [u8]) -> &mut Self[src]

Load the given timezones rules from a given slice contains an actual TimeZoneRule.

Panic:

This function panic if the given buffer is either too short or not aligned

pub fn load_rules(
    &mut self,
    input: &[u8],
    temp_rules: &mut TimeZoneRule
) -> TimeZoneResult<()>
[src]

Load the given timezones rules from a given slice containing TzIf2 data and a temporary TimeZoneRule buffer.

Note:

temp_rules is used to store parsed data from the TZ String Extensions. this shouldn't be used as a standard TimeZoneRule!

pub fn to_calendar_time(&self, time: PosixTime) -> TimeZoneResult<CalendarTime>[src]

Convert a PosixTime to a CalendarTime using the current timezone.

pub fn to_posix_time(
    &self,
    calendar_time: &CalendarTimeInfo
) -> TimeZoneResult<PosixTime>
[src]

Convert a CalendarTime to a PosixTime using the current timezone.

Trait Implementations

impl Clone for TimeZoneRule[src]

impl Copy for TimeZoneRule[src]

impl Default for TimeZoneRule[src]

impl Plain for TimeZoneRule[src]

Auto Trait Implementations

impl Send for TimeZoneRule

impl Sync for TimeZoneRule

impl Unpin for TimeZoneRule

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.