Struct icu_datetime::mock::zoned_datetime::MockZonedDateTime [−][src]
pub struct MockZonedDateTime { pub datetime: MockDateTime, pub time_zone: MockTimeZone, }
A temporary struct that implements ZonedDateTimeInput
and is used in tests, benchmarks and examples of this component.
The composition of MockDateTime
and MockTimeZone
.
Notice: Rust at the moment does not have a canonical way to represent date and time. We are introducing
MockZonedDateTime
as an example of the data necessary for ICU ZonedDateTimeFormat
to work, and
we hope to work with the community
to develop core date and time APIs that will work as an input for this component.
Examples
use icu::datetime::mock::datetime::MockDateTime; use icu::datetime::mock::time_zone::MockTimeZone; use icu::datetime::mock::zoned_datetime::MockZonedDateTime; let dt: MockDateTime = "2020-10-14T13:21:00".parse() .expect("Failed to parse a datetime."); let tz: MockTimeZone = "+05:00".parse() .expect("Failed to parse a time zone."); let zdt1 = MockZonedDateTime::new(dt, tz); let zdt2: MockZonedDateTime = "2020-10-14T13:21:00+05:00".parse() .expect("Failed to parse a zoned datetime.");
Fields
datetime: MockDateTime
The datetime component.
time_zone: MockTimeZone
The time zone component.
Implementations
impl MockZonedDateTime
[src]
impl MockZonedDateTime
[src]pub const fn new(datetime: MockDateTime, time_zone: MockTimeZone) -> Self
[src]
Creates a new MockZonedDateTime
from an already validated MockDateTime
and MockTimeZone
.
Trait Implementations
impl DateInput for MockZonedDateTime
[src]
impl DateInput for MockZonedDateTime
[src]fn year(&self) -> Option<Year>
[src]
fn month(&self) -> Option<Month>
[src]
fn day_of_month(&self) -> Option<DayOfMonth>
[src]
fn iso_weekday(&self) -> Option<IsoWeekday>
[src]
fn day_of_year_info(&self) -> Option<DayOfYearInfo>
[src]
impl Default for MockZonedDateTime
[src]
impl Default for MockZonedDateTime
[src]fn default() -> MockZonedDateTime
[src]
impl FromStr for MockZonedDateTime
[src]
impl FromStr for MockZonedDateTime
[src]type Err = DateTimeError
The associated error which can be returned from parsing.
fn from_str(input: &str) -> Result<Self, Self::Err>
[src]
Parse a MockZonedDateTime
from a string.
This utility is for easily creating dates, not a complete robust solution. The
string must take a specific form of the ISO 8601 format:
YYYY-MM-DDThh:mm:ssZ
,
YYYY-MM-DDThh:mm:ss±hh
,
YYYY-MM-DDThh:mm:ss±hhmm
,
YYYY-MM-DDThh:mm:ss±hh:mm
,
Examples
use icu::datetime::mock::zoned_datetime::MockZonedDateTime; let date: MockZonedDateTime = "2020-10-14T13:21:00+05:30".parse() .expect("Failed to parse a zoned datetime.");
impl IsoTimeInput for MockZonedDateTime
[src]
impl IsoTimeInput for MockZonedDateTime
[src]impl TimeZoneInput for MockZonedDateTime
[src]
impl TimeZoneInput for MockZonedDateTime
[src]fn gmt_offset(&self) -> GmtOffset
[src]
fn time_zone_id(&self) -> Option<&str>
[src]
fn metazone_id(&self) -> Option<&str>
[src]
fn time_variant(&self) -> Option<&str>
[src]
Auto Trait Implementations
impl RefUnwindSafe for MockZonedDateTime
impl RefUnwindSafe for MockZonedDateTime
impl Send for MockZonedDateTime
impl Send for MockZonedDateTime
impl Sync for MockZonedDateTime
impl Sync for MockZonedDateTime
impl Unpin for MockZonedDateTime
impl Unpin for MockZonedDateTime
impl UnwindSafe for MockZonedDateTime
impl UnwindSafe for MockZonedDateTime
Blanket Implementations
impl<T> DateTimeInput for T where
T: DateInput + IsoTimeInput,
[src]
impl<T> DateTimeInput for T where
T: DateInput + IsoTimeInput,
[src]impl<T> ZonedDateTimeInput for T where
T: TimeZoneInput + DateTimeInput,
[src]
impl<T> ZonedDateTimeInput for T where
T: TimeZoneInput + DateTimeInput,
[src]