pub struct UtcOffset { /* private fields */ }
Expand description
An offset from UTC.
This struct can store values up to ±25:59:59. If you need support outside this range, please file an issue with your use case.
Implementations§
source§impl UtcOffset
impl UtcOffset
sourcepub const fn from_hms(
hours: i8,
minutes: i8,
seconds: i8,
) -> Result<Self, ComponentRange>
pub const fn from_hms( hours: i8, minutes: i8, seconds: i8, ) -> Result<Self, ComponentRange>
Create a UtcOffset
representing an offset by the number of hours, minutes, and seconds
provided.
The sign of all three components should match. If they do not, all smaller components will have their signs flipped.
sourcepub const fn from_whole_seconds(seconds: i32) -> Result<Self, ComponentRange>
pub const fn from_whole_seconds(seconds: i32) -> Result<Self, ComponentRange>
sourcepub const fn whole_hours(self) -> i8
pub const fn whole_hours(self) -> i8
sourcepub const fn whole_minutes(self) -> i16
pub const fn whole_minutes(self) -> i16
sourcepub const fn minutes_past_hour(self) -> i8
pub const fn minutes_past_hour(self) -> i8
sourcepub const fn whole_seconds(self) -> i32
pub const fn whole_seconds(self) -> i32
sourcepub const fn seconds_past_minute(self) -> i8
pub const fn seconds_past_minute(self) -> i8
sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
source§impl UtcOffset
impl UtcOffset
sourcepub fn format_into(
self,
output: &mut impl Write,
format: &(impl Formattable + ?Sized),
) -> Result<usize, Format>
pub fn format_into( self, output: &mut impl Write, format: &(impl Formattable + ?Sized), ) -> Result<usize, Format>
Format the UtcOffset
using the provided format description.
sourcepub fn format(
self,
format: &(impl Formattable + ?Sized),
) -> Result<String, Format>
pub fn format( self, format: &(impl Formattable + ?Sized), ) -> Result<String, Format>
Format the UtcOffset
using the provided format description.
Trait Implementations§
source§impl Ord for UtcOffset
impl Ord for UtcOffset
source§impl PartialOrd for UtcOffset
impl PartialOrd for UtcOffset
source§impl SmartDisplay for UtcOffset
impl SmartDisplay for UtcOffset
source§fn metadata(&self, _: FormatterOptions) -> Metadata<'_, Self>
fn metadata(&self, _: FormatterOptions) -> Metadata<'_, Self>
Compute any information needed to format the value. This must, at a minimum, determine the
width of the value before any padding is added by the formatter. Read more
impl Copy for UtcOffset
impl Eq for UtcOffset
impl StructuralPartialEq for UtcOffset
Auto Trait Implementations§
impl Freeze for UtcOffset
impl RefUnwindSafe for UtcOffset
impl Send for UtcOffset
impl Sync for UtcOffset
impl Unpin for UtcOffset
impl UnwindSafe for UtcOffset
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)