TimeRange
This represents a range of time using a pair of Time
values, or open ends.
Associated functions and constants
ALWAYS
Represents a TimeRange
going from negative to positive infinity, thus contains all possible Time
values.
TimeRange::ALWAYS -> TimeRange
NEVER
Represents TimeRange
going from positive to negative infinity. It contains nothing as it's an impossible range.
TimeRange::NEVER -> TimeRange
from
Returns a TimeRange
that contains all Time
values from start
onwards.
TimeRange::from(start: Time) -> TimeRange
to
Returns a TimeRange
that contains all Time
values before end
.
TimeRange::to(end: Time) -> TimeRange
new
Returns a TimeRange
that contains all Time
values between start
and end
.
TimeRange::new(start: Time, end: Time) -> TimeRange
from_data
TimeRange::from_data(data: Data) -> TimeRange
Getters
start
Returns the start Time
of a TimeRange
. Throws an error if start is non-finite.
time_range.start -> Time
end
Returns the end Time
of a TimeRange
. Throws an error if end is non-finite.
time_range.end -> Time
Operators
==
TimeRange == TimeRange -> Bool
!=
TimeRange != TimeRange -> Bool
Methods
contains
Returns true
if a TimeRange
contains the given time.
time_range.contains(time: Time) -> Bool
is_before
Returns true
if the end of a TimeRange
is before the given time. Always returns false
if the end of the TimeRange
is positive infinity.
time_range.is_before(time: Time) -> Bool
is_after
Returns true
if the start of a TimeRange
is after the given time. Always returns false
if the start of the TimeRange
is negative infinity.
time_range.is_after(time: Time) -> Bool
serialize
time_range.serialize() -> ByteArray
show
time_range.show() -> String