pub type TimestampRange = GenericRange<Timestamp>;
Aliased Type§
struct TimestampRange {
start: Option<Timestamp>,
end: Option<Timestamp>,
}
Fields§
§start: Option<Timestamp>
§end: Option<Timestamp>
Implementations§
source§impl TimestampRange
impl TimestampRange
sourcepub fn new_inclusive(start: Option<Timestamp>, end: Option<Timestamp>) -> Self
pub fn new_inclusive(start: Option<Timestamp>, end: Option<Timestamp>) -> Self
Create a TimestampRange with optional inclusive end timestamp. If end timestamp is present and is less than start timestamp, this method will return an empty range.
§Caveat
If the given end timestamp’s value is i64::MAX
, which will result into overflow when added
by 1(the end is inclusive), this method does not try to convert the time unit of end
timestamp, instead it just return [start, INF)
. This exaggerates the range but does not
affect correctness.
sourcepub fn with_unit(start: i64, end: i64, unit: TimeUnit) -> Option<Self>
pub fn with_unit(start: i64, end: i64, unit: TimeUnit) -> Option<Self>
Shortcut method to create a timestamp range with given start/end value and time unit.
Returns empty iff start
> end
.
sourcepub fn single(ts: Timestamp) -> Self
pub fn single(ts: Timestamp) -> Self
Create a range that containing only given ts
.
§Notice:
Left-close right-open range cannot properly represent range with a single value.
For simplicity, this implementation returns an approximate range [ts, ts+1)
instead.
sourcepub fn from_start(start: Timestamp) -> Self
pub fn from_start(start: Timestamp) -> Self
Create a range [start, INF)
.
§Notice
Left-close right-open range cannot properly represent range with exclusive start like: (start, ...)
.
You may resort to [start-1, ...)
instead.