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<Self, ParseError>
 
pub fn try_from_str(rfc_9557_str: &str) -> Result<Self, 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<Self, ParseError>
 
pub fn try_from_utf8(rfc_9557_str: &[u8]) -> Result<Self, 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
Sourcepub const fn new(
    hour: Hour,
    minute: Minute,
    second: Second,
    subsecond: Nanosecond,
) -> Self
 
pub const fn new( hour: Hour, minute: Minute, second: Second, subsecond: Nanosecond, ) -> Self
Construct a new Time, without validating that all components are in range
Sourcepub const fn start_of_day() -> Self
 
pub const fn start_of_day() -> Self
Construct a new Time representing the start of the day (00:00:00.000)
Trait Implementations§
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 StructuralPartialEq 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> 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