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
Sourcepub fn local_offset_at(
datetime: OffsetDateTime,
) -> Result<Self, IndeterminateOffset>
Available on crate feature local-offset
only.
pub fn local_offset_at( datetime: OffsetDateTime, ) -> Result<Self, IndeterminateOffset>
local-offset
only.Sourcepub fn current_local_offset() -> Result<Self, IndeterminateOffset>
Available on crate feature local-offset
only.
pub fn current_local_offset() -> Result<Self, IndeterminateOffset>
local-offset
only.Source§impl UtcOffset
impl UtcOffset
Sourcepub fn format_into(
self,
output: &mut impl Write,
format: &(impl Formattable + ?Sized),
) -> Result<usize, Format>
Available on crate feature formatting
only.
pub fn format_into( self, output: &mut impl Write, format: &(impl Formattable + ?Sized), ) -> Result<usize, Format>
formatting
only.Format the UtcOffset
using the provided format description.
Sourcepub fn format(
self,
format: &(impl Formattable + ?Sized),
) -> Result<String, Format>
Available on crate feature formatting
only.
pub fn format( self, format: &(impl Formattable + ?Sized), ) -> Result<String, Format>
formatting
only.Format the UtcOffset
using the provided format description.
Trait Implementations§
Source§impl<'a> Deserialize<'a> for UtcOffset
Available on crate feature serde
only.
impl<'a> Deserialize<'a> for UtcOffset
Available on crate feature
serde
only.Source§fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Distribution<UtcOffset> for Standard
Available on crate feature rand
only.
impl Distribution<UtcOffset> for Standard
Available on crate feature
rand
only.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