Struct OffsetHours

pub struct OffsetHours(/* private field */);

The number of hours allowed in a time zone offset.

This number was somewhat arbitrarily chosen. In part because it's bigger than any current offset in actual use by a wide margin, and in part because POSIX TZ strings require the ability to store offsets in the range -24:59:59..=25:59:59. Note though that we make the range a little bigger with -25:59:59..=25:59:59 so that negating an offset always produces a valid offset.

Note that RFC 8536 actually allows offsets to be much bigger, namely, in the range (-2^31, 2^31), where both ends are exclusive (-2^31 is explicitly disallowed, and 2^31 overflows a signed 32-bit integer). But RFC 8536 does say that it should be in the range [-89999, 93599], which matches POSIX. In order to keep our offset small, we stick roughly to what POSIX requires.

Note that we support a slightly bigger range of offsets than Temporal. Temporal seems to support only up to 23 hours, but we go up to 25 hours. This is done to support POSIX time zone strings, which also require 25 hours (plus the maximal minute/second components).

Implementations

impl OffsetHours

const MIN: i8 = <OffsetHours as Bounds>::MIN;
const MAX: i8 = <OffsetHours as Bounds>::MAX;
const LEN: i128 = _;
const fn error() -> BoundsError
fn check(n: impl Into<i64>) -> Result<i8, BoundsError>
const fn checkc(n: i64) -> Result<i8, BoundsError>
const fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError>
fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError>

Trait Implementations

impl Bounds for OffsetHours

const WHAT: &'static str = "time zone offset hours";
const MIN: Self::Primitive = -25;
const MAX: Self::Primitive = 25;
type Primitive = i8;
type Error = BoundsError;
fn error() -> BoundsError

impl Eq for OffsetHours

impl PartialEq for OffsetHours

fn eq(&self, other: &OffsetHours) -> bool

impl StructuralPartialEq for OffsetHours

Auto Trait Implementations

impl Freeze for OffsetHours

impl RefUnwindSafe for OffsetHours

impl Send for OffsetHours

impl Sync for OffsetHours

impl Unpin for OffsetHours

impl UnsafeUnpin for OffsetHours

impl UnwindSafe for OffsetHours

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for OffsetHours

fn from(t: T) -> T

Returns the argument unchanged.

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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