Struct temporal_rs::components::Time
source · #[non_exhaustive]pub struct Time { /* private fields */ }
Expand description
The native Rust implementation of Temporal.PlainTime
.
Implementations§
source§impl Time
impl Time
sourcepub fn new(
hour: i32,
minute: i32,
second: i32,
millisecond: i32,
microsecond: i32,
nanosecond: i32,
overflow: ArithmeticOverflow
) -> TemporalResult<Self>
pub fn new( hour: i32, minute: i32, second: i32, millisecond: i32, microsecond: i32, nanosecond: i32, overflow: ArithmeticOverflow ) -> TemporalResult<Self>
Creates a new IsoTime
value.
sourcepub const fn millisecond(&self) -> u16
pub const fn millisecond(&self) -> u16
Returns the internal millisecond
field.
sourcepub const fn microsecond(&self) -> u16
pub const fn microsecond(&self) -> u16
Returns the internal microsecond
field.
sourcepub const fn nanosecond(&self) -> u16
pub const fn nanosecond(&self) -> u16
Returns the internal nanosecond
field.
sourcepub fn add(&self, duration: &Duration) -> TemporalResult<Self>
pub fn add(&self, duration: &Duration) -> TemporalResult<Self>
Add a Duration
to the current Time
.
sourcepub fn add_time_duration(&self, duration: &TimeDuration) -> Self
pub fn add_time_duration(&self, duration: &TimeDuration) -> Self
Adds a TimeDuration
to the current Time
.
sourcepub fn subtract(&self, duration: &Duration) -> TemporalResult<Self>
pub fn subtract(&self, duration: &Duration) -> TemporalResult<Self>
Subtract a Duration
to the current Time
.
sourcepub fn subtract_time_duration(&self, duration: &TimeDuration) -> Self
pub fn subtract_time_duration(&self, duration: &TimeDuration) -> Self
Adds a TimeDuration
to the current Time
.
sourcepub fn round(
&self,
smallest_unit: TemporalUnit,
rounding_increment: Option<f64>,
rounding_mode: Option<TemporalRoundingMode>
) -> TemporalResult<Self>
pub fn round( &self, smallest_unit: TemporalUnit, rounding_increment: Option<f64>, rounding_mode: Option<TemporalRoundingMode> ) -> TemporalResult<Self>
Rounds the current Time
according to provided options.
Trait Implementations§
source§impl Ord for Time
impl Ord for Time
source§impl PartialEq for Time
impl PartialEq for Time
source§impl PartialOrd for Time
impl PartialOrd for Time
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
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