Struct FixedOffset
struct FixedOffset { ... }
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: &Self) -> i32Returns the number of seconds to add to convert from UTC to the local time.
const fn utc_minus_local(self: &Self) -> i32Returns the number of seconds to add to convert from the local time to UTC.
impl Clone for FixedOffset
fn clone(self: &Self) -> FixedOffset
impl Copy for FixedOffset
impl Debug for FixedOffset
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Display for FixedOffset
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for FixedOffset
impl Freeze for FixedOffset
impl FromStr for FixedOffset
fn from_str(s: &str) -> Result<Self, <Self as >::Err>
impl Hash for FixedOffset
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Offset for FixedOffset
fn fix(self: &Self) -> FixedOffset
impl PartialEq for FixedOffset
fn eq(self: &Self, other: &FixedOffset) -> bool
impl RefUnwindSafe for FixedOffset
impl Send for FixedOffset
impl StructuralPartialEq for FixedOffset
impl Sync for FixedOffset
impl TimeZone for FixedOffset
fn from_offset(offset: &FixedOffset) -> FixedOffsetfn offset_from_local_date(self: &Self, _local: &NaiveDate) -> MappedLocalTime<FixedOffset>fn offset_from_local_datetime(self: &Self, _local: &NaiveDateTime) -> MappedLocalTime<FixedOffset>fn offset_from_utc_date(self: &Self, _utc: &NaiveDate) -> FixedOffsetfn offset_from_utc_datetime(self: &Self, _utc: &NaiveDateTime) -> FixedOffset
impl Unpin for FixedOffset
impl UnsafeUnpin for FixedOffset
impl UnwindSafe for FixedOffset
impl<T> Any for FixedOffset
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for FixedOffset
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for FixedOffset
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for FixedOffset
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for FixedOffset
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for FixedOffset
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for FixedOffset
fn to_string(self: &Self) -> String
impl<T, U> Into for FixedOffset
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 FixedOffset
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for FixedOffset
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>