jiff::fmt::offset

Struct Numeric

Source
struct Numeric {
    sign: ri8<-1, 1>,
    hours: ri8<0, { t::SpanZoneOffsetHours::MAX }>,
    minutes: Option<ri8<0, { t::SpanZoneOffsetMinutes::MAX }>>,
    seconds: Option<ri8<0, { t::SpanZoneOffsetSeconds::MAX }>>,
    nanoseconds: Option<ri32<0, { _ }>>,
}
Expand description

A numeric representation of a UTC offset.

Fields§

§sign: ri8<-1, 1>

The sign that was parsed from the numeric UTC offset. This is always either 1 or -1, never 0.

§hours: ri8<0, { t::SpanZoneOffsetHours::MAX }>

The hours component. This is non-optional because every UTC offset must have at least hours.

§minutes: Option<ri8<0, { t::SpanZoneOffsetMinutes::MAX }>>

The minutes component.

§seconds: Option<ri8<0, { t::SpanZoneOffsetSeconds::MAX }>>

The seconds component. This is only possible when subminute resolution is enabled.

§nanoseconds: Option<ri32<0, { _ }>>

The nanoseconds fractional component. This is only possible when subminute resolution is enabled.

Implementations§

Source§

impl Numeric

Source

fn to_offset(&self) -> Result<Offset, Error>

Convert a parsed numeric offset into a Jiff offset.

This does rounding based on the fractional nanosecond part. As a result, if the parsed value would be rounded to a value not in bounds for a Jiff offset, this returns an error.

Trait Implementations§

Source§

impl Debug for Numeric

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Numeric

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.