pub struct Datetime {
pub date: Option<LocalDate>,
pub time: Option<LocalTime>,
pub offset: Option<Offset>,
}Expand description
A TOML date-time value.
This struct can represent any of the TOML date-time types, depending on which fields are
Some:
date | time | offset | type |
|---|---|---|---|
Some | Some | Some | Offset date-time |
Some | Some | None | Local date-time |
Some | None | None | Local date |
None | Some | None | Local time |
All other combinations are considered invalid
If compatibility with the toml crate is not needed, the AnyDatetime enum is recommended
instead. Or when working with a known date-time type, one of the OffsetDatetime,
LocalDatetime, LocalDate, or LocalTime types should be used.
Fields§
§date: Option<LocalDate>The date portion of the date-time value.
time: Option<LocalTime>The time portion of the date-time value.
offset: Option<Offset>The UTC offset of the date-time value.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Datetime
impl<'de> Deserialize<'de> for Datetime
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AnyDatetime> for Datetime
impl From<AnyDatetime> for Datetime
Source§fn from(value: AnyDatetime) -> Self
fn from(value: AnyDatetime) -> Self
Converts to this type from the input type.
Source§impl From<LocalDatetime> for Datetime
impl From<LocalDatetime> for Datetime
Source§fn from(value: LocalDatetime) -> Self
fn from(value: LocalDatetime) -> Self
Converts to this type from the input type.
Source§impl From<OffsetDatetime> for Datetime
impl From<OffsetDatetime> for Datetime
Source§fn from(value: OffsetDatetime) -> Self
fn from(value: OffsetDatetime) -> Self
Converts to this type from the input type.
Source§impl TryFrom<Datetime> for AnyDatetime
impl TryFrom<Datetime> for AnyDatetime
Source§impl TryFrom<Datetime> for LocalDatetime
impl TryFrom<Datetime> for LocalDatetime
Source§impl TryFrom<Datetime> for OffsetDatetime
impl TryFrom<Datetime> for OffsetDatetime
impl Eq for Datetime
impl StructuralPartialEq for Datetime
Auto Trait Implementations§
impl Freeze for Datetime
impl RefUnwindSafe for Datetime
impl Send for Datetime
impl Sync for Datetime
impl Unpin for Datetime
impl UnwindSafe for Datetime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more