/// An ICU4X DateTime object capable of containing a ISO-8601 date and time. #[diplomat::rust_link(icu::time::DateTime, Struct)] #[diplomat::out] pubstruct IsoDateTime { pub date: Box<IsoDate>, pub time: Box<Time>,
}
impl IsoDateTime { /// Creates a new [`IsoDateTime`] from an IXDTF string. #[diplomat::rust_link(icu::time::DateTime::try_from_str, FnInStruct)] #[diplomat::rust_link(icu::time::DateTime::try_from_utf8, FnInStruct, hidden)] #[diplomat::rust_link(icu::time::DateTime::from_str, FnInStruct, hidden)] #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor)] pubfn from_string(v: &DiplomatStr) -> Result<IsoDateTime, Rfc9557ParseError> { let icu_time::DateTime { date, time } = icu_time::DateTime::try_from_utf8(v, Iso)?;
Ok(IsoDateTime {
date: Box::new(IsoDate(date)),
time: Box::new(Time(time)),
})
}
}
/// An ICU4X DateTime object capable of containing a date and time for any calendar. #[diplomat::rust_link(icu::time::DateTime, Struct)] #[diplomat::out] pubstruct DateTime { pub date: Box<Date>, pub time: Box<Time>,
}
impl DateTime { /// Creates a new [`DateTime`] from an IXDTF string. #[diplomat::rust_link(icu::time::DateTime::try_from_str, FnInStruct)] #[diplomat::rust_link(icu::time::DateTime::try_from_utf8, FnInStruct, hidden)] #[diplomat::rust_link(icu::time::DateTime::from_str, FnInStruct, hidden)] #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor)] pubfn from_string(
v: &DiplomatStr,
calendar: &Calendar,
) -> Result<DateTime, Rfc9557ParseError> { let icu_time::DateTime { date, time } =
icu_time::DateTime::try_from_utf8(v, calendar.0.clone())?;
Ok(DateTime {
date: Box::new(Date(date)),
time: Box::new(Time(time)),
})
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.