pub struct Interval {
pub lower: ScalarValue,
pub upper: ScalarValue,
}
Expand description
This type represents an interval, which is used to calculate reliable bounds for expressions. Currently, we only support addition and subtraction, but more capabilities will be added in the future. Upper/lower bounds having NULL values indicate an unbounded side. For example; [10, 20], [10, ∞], [-∞, 100] and [-∞, ∞] are all valid intervals.
Fields§
§lower: ScalarValue
§upper: ScalarValue
Implementations§
source§impl Interval
impl Interval
sourcepub fn add<T: Borrow<Interval>>(&self, other: T) -> Result<Interval>
pub fn add<T: Borrow<Interval>>(&self, other: T) -> Result<Interval>
Add the given interval (other
) to this interval. Say we have
intervals [a1, b1] and [a2, b2], then their sum is [a1 + a2, b1 + b2].
Note that this represents all possible values the sum can take if
one can choose single values arbitrarily from each of the operands.
sourcepub fn sub<T: Borrow<Interval>>(&self, other: T) -> Result<Interval>
pub fn sub<T: Borrow<Interval>>(&self, other: T) -> Result<Interval>
Subtract the given interval (other
) from this interval. Say we have
intervals [a1, b1] and [a2, b2], then their sum is [a1 - b2, b1 - a2].
Note that this represents all possible values the difference can take
if one can choose single values arbitrarily from each of the operands.
Trait Implementations§
source§impl PartialEq<Interval> for Interval
impl PartialEq<Interval> for Interval
impl Eq for Interval
impl StructuralEq for Interval
impl StructuralPartialEq for Interval
Auto Trait Implementations§
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.