Struct UtcOffset
struct UtcOffset { ... }
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
impl UtcOffset
const fn from_hms(hours: i8, minutes: i8, seconds: i8) -> Result<Self, ComponentRange>Create a
UtcOffsetrepresenting 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.
# use UtcOffset; assert_eq!; assert_eq!; # Ok::const fn from_whole_seconds(seconds: i32) -> Result<Self, ComponentRange>Create a
UtcOffsetrepresenting an offset by the number of seconds provided.# use UtcOffset; assert_eq!; # Ok::const fn as_hms(self: Self) -> (i8, i8, i8)Obtain the UTC offset as its hours, minutes, and seconds. The sign of all three components will always match. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn whole_hours(self: Self) -> i8Obtain the number of whole hours the offset is from UTC. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn whole_minutes(self: Self) -> i16Obtain the number of whole minutes the offset is from UTC. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn minutes_past_hour(self: Self) -> i8Obtain the number of minutes past the hour the offset is from UTC. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn whole_seconds(self: Self) -> i32Obtain the number of whole seconds the offset is from UTC. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn seconds_past_minute(self: Self) -> i8Obtain the number of seconds past the minute the offset is from UTC. A positive value indicates an offset to the east; a negative to the west.
# use offset; assert_eq!; assert_eq!;const fn is_utc(self: Self) -> boolCheck if the offset is exactly UTC.
# use offset; assert!; assert!; assert!;const fn is_positive(self: Self) -> boolCheck if the offset is positive, or east of UTC.
# use offset; assert!; assert!; assert!;const fn is_negative(self: Self) -> boolCheck if the offset is negative, or west of UTC.
# use offset; assert!; assert!; assert!;
impl Clone for UtcOffset
fn clone(self: &Self) -> UtcOffset
impl Copy for UtcOffset
impl Debug for UtcOffset
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Display for UtcOffset
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for UtcOffset
impl Freeze for UtcOffset
impl Hash for UtcOffset
fn hash<H>(self: &Self, state: &mut H) where H: Hasher
impl Neg for UtcOffset
fn neg(self: Self) -> <Self as >::Output
impl Ord for UtcOffset
fn cmp(self: &Self, other: &Self) -> Ordering
impl PartialEq for UtcOffset
fn eq(self: &Self, other: &Self) -> bool
impl PartialOrd for UtcOffset
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>
impl RefUnwindSafe for UtcOffset
impl Send for UtcOffset
impl SmartDisplay for UtcOffset
fn metadata(self: &Self, _: FormatterOptions) -> Metadata<'_, Self>fn fmt_with_metadata(self: &Self, f: &mut Formatter<'_>, metadata: Metadata<'_, Self>) -> Result
impl Sync for UtcOffset
impl Unpin for UtcOffset
impl UnsafeUnpin for UtcOffset
impl UnwindSafe for UtcOffset
impl<T> Any for UtcOffset
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for UtcOffset
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for UtcOffset
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for UtcOffset
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for UtcOffset
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for UtcOffset
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for UtcOffset
fn to_string(self: &Self) -> String
impl<T, U> Into for UtcOffset
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for UtcOffset
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for UtcOffset
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>