pub struct StoryDate { /* private fields */ }
Expand description
Story-specific date that wraps all of the operations we’re interested in. This is a thin wrapper on top
of DateTime<Utc>
and other chrono
utilities for now.
Implementations§
Source§impl StoryDate
impl StoryDate
pub const MAX: StoryDate
pub const MIN: StoryDate
pub const fn new(internal_date: DateTime<Utc>) -> Self
pub fn year_month_day(year: i32, month: u32, day: u32) -> Option<Self>
pub fn now() -> Self
pub fn from_millis(millis: i64) -> Option<Self>
pub fn from_seconds(seconds: i64) -> Option<Self>
pub fn from_string(date: &str, s: &str) -> Option<Self>
pub fn parse_from_rfc3339(date: &str) -> Option<Self>
pub fn parse_from_rfc3339_loose(date: &str) -> Option<Self>
pub fn to_rfc3339(&self) -> String
pub fn to_rfc2822(&self) -> String
pub fn parse_from_rfc2822(date: &str) -> Option<Self>
pub fn year(&self) -> i32
pub fn month(&self) -> u32
pub fn month0(&self) -> u32
pub fn day(&self) -> u32
pub fn day0(&self) -> u32
pub fn timestamp(&self) -> i64
pub fn checked_add_months(&self, months: u32) -> Option<Self>
pub fn checked_sub_months(&self, months: u32) -> Option<Self>
pub fn checked_add_days(&self, days: u64) -> Option<Self>
pub fn checked_sub_days(&self, days: u64) -> Option<Self>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StoryDate
impl<'de> Deserialize<'de> for StoryDate
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 StoryDate
impl Ord for StoryDate
Source§impl PartialOrd for StoryDate
impl PartialOrd for StoryDate
impl Copy for StoryDate
impl Eq for StoryDate
impl StructuralPartialEq for StoryDate
Auto Trait Implementations§
impl Freeze for StoryDate
impl RefUnwindSafe for StoryDate
impl Send for StoryDate
impl Sync for StoryDate
impl Unpin for StoryDate
impl UnwindSafe for StoryDate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more