Struct FixedOffset
pub struct FixedOffset { /* private fields */ }
The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59.
Using the TimeZone methods
on a FixedOffset struct is the preferred way to construct
DateTime<FixedOffset> instances. See the east_opt and
west_opt methods for examples.
Implementations
impl FixedOffset
fn east(secs: i32) -> FixedOffsetMakes a new
FixedOffsetfor the Eastern Hemisphere with given timezone difference. The negativesecsmeans the Western Hemisphere.Panics on the out-of-bound
secs.const fn east_opt(secs: i32) -> Option<FixedOffset>Makes a new
FixedOffsetfor the Eastern Hemisphere with given timezone difference. The negativesecsmeans the Western Hemisphere.Returns
Noneon the out-of-boundsecs.Example
#fn west(secs: i32) -> FixedOffsetMakes a new
FixedOffsetfor the Western Hemisphere with given timezone difference. The negativesecsmeans the Eastern Hemisphere.Panics on the out-of-bound
secs.const fn west_opt(secs: i32) -> Option<FixedOffset>Makes a new
FixedOffsetfor the Western Hemisphere with given timezone difference. The negativesecsmeans the Eastern Hemisphere.Returns
Noneon the out-of-boundsecs.Example
#const fn local_minus_utc(&self) -> i32Returns the number of seconds to add to convert from UTC to the local time.
const fn utc_minus_local(&self) -> i32Returns the number of seconds to add to convert from the local time to UTC.
Trait Implementations
impl Clone for FixedOffset
fn clone(&self) -> FixedOffset
impl Copy for FixedOffset
impl Debug for FixedOffset
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for FixedOffset
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for FixedOffset
impl FromStr for FixedOffset
type Err = ParseError;fn from_str(s: &str) -> Result<Self, Self::Err>
impl Hash for FixedOffset
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Offset for FixedOffset
fn fix(&self) -> FixedOffset
impl PartialEq for FixedOffset
fn eq(&self, other: &FixedOffset) -> bool
impl StructuralPartialEq for FixedOffset
impl TimeZone for FixedOffset
type Offset = FixedOffset;fn from_offset(offset: &FixedOffset) -> FixedOffsetfn offset_from_local_date(&self, _local: &NaiveDate) -> MappedLocalTime<FixedOffset>fn offset_from_local_datetime(&self, _local: &NaiveDateTime) -> MappedLocalTime<FixedOffset>fn offset_from_utc_date(&self, _utc: &NaiveDate) -> FixedOffsetfn offset_from_utc_datetime(&self, _utc: &NaiveDateTime) -> FixedOffset
Auto Trait Implementations
impl Freeze for FixedOffset
impl RefUnwindSafe for FixedOffset
impl Send for FixedOffset
impl Sync for FixedOffset
impl Unpin for FixedOffset
impl UnsafeUnpin for FixedOffset
impl UnwindSafe for FixedOffset
Blanket Implementations
impl<T> Any for FixedOffset
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for FixedOffset
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for FixedOffset
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for FixedOffset
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for FixedOffset
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for FixedOffset
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for FixedOffset
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for FixedOffset
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for FixedOffset
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 FixedOffset
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>