pub struct Date { /* private fields */ }Expand description
The OpenTimeline date type
The year field must be set but the day and month fields are optional. If the day field is set the month field must be set, but if the month field is set, the day field is optional.
Implementations§
Source§impl Date
impl Date
Sourcepub fn from(
day: Option<i64>,
month: Option<i64>,
year: i64,
) -> Result<Date, DateError>
pub fn from( day: Option<i64>, month: Option<i64>, year: i64, ) -> Result<Date, DateError>
Create a new Date if the result will be valid
Sourcepub fn as_long_date_format(&self) -> String
pub fn as_long_date_format(&self) -> String
e.g. 1st Jan 2025 format
Sourcepub fn as_short_date_format(&self) -> String
pub fn as_short_date_format(&self) -> String
dd/mm/yyyy format
Sourcepub fn set_day(&mut self, day: Option<i64>) -> Result<(), DateError>
pub fn set_day(&mut self, day: Option<i64>) -> Result<(), DateError>
Update an existing Date’s day if the result will be valid
Sourcepub fn set_month(&mut self, month: Option<i64>) -> Result<(), DateError>
pub fn set_month(&mut self, month: Option<i64>) -> Result<(), DateError>
Update an existing Date’s month if the result will be valid
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Date
impl<'de> Deserialize<'de> for Date
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 Ord for Date
impl Ord for Date
Source§impl PartialOrd for Date
impl PartialOrd for Date
impl Copy for Date
impl Eq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnsafeUnpin for Date
impl UnwindSafe for Date
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