pub struct WorkInterval {
pub start: NaiveDateTime,
pub end: NaiveDateTime,
pub duration: Duration,
pub pause_after: Option<usize>,
}Expand description
One uninterrupted stretch of work between pauses (or day bounds).
Fields§
§start: NaiveDateTimeWorkday start, or the end of the previous pause.
end: NaiveDateTimeStart of the next pause, or the workday end.
duration: Durationend - start.
pause_after: Option<usize>Index (into the original pause list) of the pause that ended this
interval; None for the day’s final interval.
Implementations§
Source§impl WorkInterval
impl WorkInterval
Sourcepub fn is_short(&self, min_minutes: u64) -> bool
pub fn is_short(&self, min_minutes: u64) -> bool
True when the interval is under min_minutes.
use kasl::libs::report::WorkInterval;
use chrono::{Duration, Local};
let start_time = Local::now().naive_local();
let interval = WorkInterval {
start: start_time,
end: start_time + Duration::minutes(20),
duration: Duration::minutes(20),
pause_after: Some(1),
};
assert_eq!(interval.is_short(30), true); // 20 < 30
assert_eq!(interval.is_short(15), false); // 20 >= 15Trait Implementations§
Source§impl Clone for WorkInterval
impl Clone for WorkInterval
Source§fn clone(&self) -> WorkInterval
fn clone(&self) -> WorkInterval
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkInterval
impl RefUnwindSafe for WorkInterval
impl Send for WorkInterval
impl Sync for WorkInterval
impl Unpin for WorkInterval
impl UnsafeUnpin for WorkInterval
impl UnwindSafe for WorkInterval
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