Struct rust_icu_ucal::UCalendar
source · pub struct UCalendar { /* private fields */ }
Expand description
Implements the UCalendar type from ucal.h
.
The naming rust_icu_ucal::UCalendar
is a bit repetetetitive, but makes it
a bit more obvious what ICU type it is wrapping.
Implementations§
source§impl UCalendar
impl UCalendar
sourcepub fn new(
zone_id: &str,
locale: &str,
cal_type: UCalendarType,
) -> Result<UCalendar, Error>
pub fn new( zone_id: &str, locale: &str, cal_type: UCalendarType, ) -> Result<UCalendar, Error>
Creates a new UCalendar.
Implements ucal_open
.
sourcepub fn as_c_calendar(&self) -> *const UCalendar
pub fn as_c_calendar(&self) -> *const UCalendar
Returns this UCalendar’s internal C representation. Use only for interfacing with the C low-level API.
sourcepub fn set_millis(&mut self, date_time: UDate) -> Result<(), Error>
pub fn set_millis(&mut self, date_time: UDate) -> Result<(), Error>
Sets the calendar’s current date/time in milliseconds since the epoch.
Implements ucal_setMillis
.
sourcepub fn get_millis(&self) -> Result<UDate, Error>
pub fn get_millis(&self) -> Result<UDate, Error>
Gets the calendar’s current date/time in milliseconds since the epoch.
Implements ucal_getMillis
.
sourcepub fn set_date(
&mut self,
year: i32,
month: i32,
date: i32,
) -> Result<(), Error>
pub fn set_date( &mut self, year: i32, month: i32, date: i32, ) -> Result<(), Error>
Sets the calendar’s current date in the calendar’s local time zone.
Note that month
is 0-based.
Implements ucal_setDate
.
sourcepub fn set_date_time(
&mut self,
year: i32,
month: i32,
date: i32,
hour: i32,
minute: i32,
second: i32,
) -> Result<(), Error>
pub fn set_date_time( &mut self, year: i32, month: i32, date: i32, hour: i32, minute: i32, second: i32, ) -> Result<(), Error>
Sets the calendar’s current date and time in the calendar’s local time zone.
Note that month
is 0-based.
Implements ucal_setDateTime
.
sourcepub fn get_zone_offset(&self) -> Result<i32, Error>
pub fn get_zone_offset(&self) -> Result<i32, Error>
Returns the calendar’s time zone’s offset from UTC in milliseconds, for the calendar’s current date/time.
This does not include the daylight savings offset, if any. Note that the calendar’s current date/time is significant because time zones are occasionally redefined – a time zone that has a +16.5 hour offset today might have had a +17 hour offset a decade ago.
Wraps ucal_get
for UCAL_ZONE_OFFSET
.
sourcepub fn get_dst_offset(&self) -> Result<i32, Error>
pub fn get_dst_offset(&self) -> Result<i32, Error>
Returns the calendar’s daylight savings offset from its non-DST time, in milliseconds, for the calendar’s current date/time. This may be 0 if the time zone does not observe DST at all, or if the time zone is not in the daylight savings period at the calendar’s current date/time.
Wraps ucal_get
for UCAL_ZONE_DST_OFFSET
.
sourcepub fn in_daylight_time(&self) -> Result<bool, Error>
pub fn in_daylight_time(&self) -> Result<bool, Error>
Returns true if the calendar is currently in daylight savings / summer time.
Implements ucal_inDaylightTime
.