pub struct Time {
    pub hour: Hour,
    pub minute: Minute,
    pub second: Second,
    pub subsecond: Nanosecond,
}Expand description
A representation of a time in hours, minutes, seconds, and nanoseconds
The primary definition of this type is in the icu_time crate. Other ICU4X crates re-export it for convenience.
This type supports the range [00:00:00.000000000, 23:59:60.999999999].
Fields§
§hour: HourHour
minute: MinuteMinute
second: SecondSecond
subsecond: NanosecondSubsecond
Implementations§
Source§impl Time
 
impl Time
Sourcepub fn try_from_str(rfc_9557_str: &str) -> Result<Time, ParseError>
 
pub fn try_from_str(rfc_9557_str: &str) -> Result<Time, ParseError>
Creates a Time from an RFC 9557 string of a time.
Does not support parsing an RFC 9557 string with a date and time; for that, use DateTime.
✨ Enabled with the ixdtf Cargo feature.
§Examples
use icu::time::Time;
let time = Time::try_from_str("16:01:17.045").unwrap();
assert_eq!(time.hour.number(), 16);
assert_eq!(time.minute.number(), 1);
assert_eq!(time.second.number(), 17);
assert_eq!(time.subsecond.number(), 45000000);Sourcepub fn try_from_utf8(rfc_9557_str: &[u8]) -> Result<Time, ParseError>
 
pub fn try_from_utf8(rfc_9557_str: &[u8]) -> Result<Time, ParseError>
Creates a Time in the ISO-8601 calendar from an RFC 9557 string.
✨ Enabled with the ixdtf Cargo feature.
See Self::try_from_str().
Source§impl Time
 
impl Time
Trait Implementations§
Source§impl ConvertCalendar for Time
 
impl ConvertCalendar for Time
Source§fn to_calendar<'a>(
    &self,
    _: &'a AnyCalendar,
) -> <Time as ConvertCalendar>::Converted<'a>
 
fn to_calendar<'a>( &self, _: &'a AnyCalendar, ) -> <Time as ConvertCalendar>::Converted<'a>
Converts 
self to the specified AnyCalendar.Source§impl GetField<Nanosecond> for Time
 
impl GetField<Nanosecond> for Time
Source§fn get_field(&self) -> Nanosecond
 
fn get_field(&self) -> Nanosecond
Returns the value of this trait’s field 
T.Source§impl InSameCalendar for Time
 
impl InSameCalendar for Time
Source§fn check_any_calendar_kind(
    &self,
    _: AnyCalendarKind,
) -> Result<(), MismatchedCalendarError>
 
fn check_any_calendar_kind( &self, _: AnyCalendarKind, ) -> Result<(), MismatchedCalendarError>
Checks whether this type is compatible with the given calendar. Read more
Source§impl Ord for Time
 
impl Ord for Time
Source§impl PartialOrd for Time
 
impl PartialOrd for Time
impl Copy for Time
impl Eq for Time
impl<C> InFixedCalendar<C> for Time
impl StructuralPartialEq for Time
impl UnstableSealed for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> GetField<T> for Twhere
    T: Copy + UnstableSealed,
 
impl<T> GetField<T> for Twhere
    T: Copy + UnstableSealed,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more