Enum Dst

pub enum Dst

An enum indicating whether a particular datetime is in DST or not.

DST stands for "daylight saving time." It is a label used to apply to points in time as a way to contrast it with "standard time." DST is usually, but not always, one hour ahead of standard time. When DST takes effect is usually determined by governments, and the rules can vary depending on the location. DST is typically used as a means to maximize "sunlight" time during typical working hours, and as a cost cutting measure by reducing energy consumption. (The effectiveness of DST and whether it is overall worth it is a separate question entirely.)

In general, most users should never need to deal with this type. But it can be occasionally useful in circumstances where callers need to know whether DST is active or not for a particular point in time.

This type has a From<bool> trait implementation, where the bool is interpreted as being true when DST is active.

Variants

No

DST is not in effect. In other words, standard time is in effect.

Yes

DST is in effect.

Implementations

impl Dst

fn is_dst(self) -> bool

Returns true when this value is equal to Dst::Yes.

fn is_std(self) -> bool

Returns true when this value is equal to Dst::No.

std in this context refers to "standard time." That is, it is the offset from UTC used when DST is not in effect.

Trait Implementations

impl Clone for Dst

fn clone(&self) -> Dst

impl Copy for Dst

impl Debug for Dst

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

impl Eq for Dst

impl From<bool> for Dst

fn from(is_dst: bool) -> Dst

impl Hash for Dst

fn hash<__H: Hasher>(&self, state: &mut __H)

impl Ord for Dst

fn cmp(&self, other: &Dst) -> Ordering

impl PartialEq for Dst

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

impl PartialOrd for Dst

fn partial_cmp(&self, other: &Dst) -> Option<Ordering>

impl StructuralPartialEq for Dst

Auto Trait Implementations

impl Freeze for Dst

impl RefUnwindSafe for Dst

impl Send for Dst

impl Sync for Dst

impl Unpin for Dst

impl UnsafeUnpin for Dst

impl UnwindSafe for Dst

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for Dst where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Dst

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Dst where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Dst 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 Dst 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 Dst where U: TryFrom<T>,

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