pub struct TimeInterval { /* private fields */ }Implementations§
Source§impl TimeInterval
Python versions of many of these functions can be found at https://github.com/ErikBjare/timeslot
impl TimeInterval
Python versions of many of these functions can be found at https://github.com/ErikBjare/timeslot
pub fn new(start: DateTime<Utc>, end: DateTime<Utc>) -> TimeInterval
pub fn new_from_string(period: &str) -> Result<TimeInterval, TimeIntervalError>
pub fn start(&self) -> &DateTime<Utc>
pub fn end(&self) -> &DateTime<Utc>
pub fn duration(&self) -> Duration
Sourcepub fn gap(&self, other: &TimeInterval) -> Option<TimeInterval>
pub fn gap(&self, other: &TimeInterval) -> Option<TimeInterval>
If intervals are separated by a non-zero gap, return the gap as a new TimeInterval, else None
Sourcepub fn union(&self, other: &TimeInterval) -> Option<TimeInterval>
pub fn union(&self, other: &TimeInterval) -> Option<TimeInterval>
Joins two intervals together if they don’t have a gap, else None
Trait Implementations§
Source§impl Clone for TimeInterval
impl Clone for TimeInterval
Source§fn clone(&self) -> TimeInterval
fn clone(&self) -> TimeInterval
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimeInterval
impl Debug for TimeInterval
Source§impl<'de> Deserialize<'de> for TimeInterval
impl<'de> Deserialize<'de> for TimeInterval
Source§fn deserialize<D>(deserializer: D) -> Result<TimeInterval, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<TimeInterval, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TimeInterval
impl RefUnwindSafe for TimeInterval
impl Send for TimeInterval
impl Sync for TimeInterval
impl Unpin for TimeInterval
impl UnwindSafe for TimeInterval
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