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
)