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

source

pub fn new( zone_id: &str, locale: &str, cal_type: UCalendarType ) -> Result<UCalendar, Error>

Creates a new UCalendar.

Implements ucal_open.

source

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.

source

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.

source

pub fn get_millis(&self) -> Result<UDate, Error>

Gets the calendar’s current date/time in milliseconds since the epoch.

Implements ucal_getMillis.

source

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.

source

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.

source

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.

source

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.

source

pub fn in_daylight_time(&self) -> Result<bool, Error>

Returns true if the calendar is currently in daylight savings / summer time.

Implements ucal_inDaylightTime.

source

pub fn get(&self, field: UCalendarDateFields) -> Result<i32, Error>

Implements ucal_get.

Consider using specific higher-level methods instead.

Trait Implementations§

source§

impl Debug for UCalendar

source§

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

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

impl Drop for UCalendar

source§

fn drop(&mut self)

Deallocates the internal representation of UCalendar.

Implements ucal_close.

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.