Struct vrp_core::models::common::TimeWindow
source · pub struct TimeWindow {
pub start: Timestamp,
pub end: Timestamp,
}
Expand description
Represents a time window.
Fields§
§start: Timestamp
Start of time window.
end: Timestamp
End of time window.
Implementations§
source§impl TimeWindow
impl TimeWindow
sourcepub fn new(start: Timestamp, end: Timestamp) -> Self
pub fn new(start: Timestamp, end: Timestamp) -> Self
Creates a new TimeWindow
.
sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Checks whether time window has intersection with another one (inclusive).
sourcepub fn intersects_exclusive(&self, other: &Self) -> bool
pub fn intersects_exclusive(&self, other: &Self) -> bool
Checks whether time window has intersection with another one (exclusive).
sourcepub fn contains(&self, time: Timestamp) -> bool
pub fn contains(&self, time: Timestamp) -> bool
Checks whether time window contains given time.
sourcepub fn overlapping(&self, other: &Self) -> Option<TimeWindow>
pub fn overlapping(&self, other: &Self) -> Option<TimeWindow>
Returns a new overlapping time window.
Trait Implementations§
source§impl Clone for TimeWindow
impl Clone for TimeWindow
source§fn clone(&self) -> TimeWindow
fn clone(&self) -> TimeWindow
Returns a copy 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 TimeWindow
impl Debug for TimeWindow
source§impl Hash for TimeWindow
impl Hash for TimeWindow
source§impl PartialEq for TimeWindow
impl PartialEq for TimeWindow
source§fn eq(&self, other: &TimeWindow) -> bool
fn eq(&self, other: &TimeWindow) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for TimeWindow
Auto Trait Implementations§
impl RefUnwindSafe for TimeWindow
impl Send for TimeWindow
impl Sync for TimeWindow
impl Unpin for TimeWindow
impl UnwindSafe for TimeWindow
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