Decide if this interval is a superset of, overlaps with, or disjoint with `other` by returning `[true, true]`, `[false, true]` or `[false, false]` respectively. If the two intervals have different data types, both are coerced to a common comparison type via [`comparison_coercion`] before checking containment.
(&self, other: T)
| 744 | /// common comparison type via [`comparison_coercion`] before checking |
| 745 | /// containment. |
| 746 | pub fn contains<T: Borrow<Self>>(&self, other: T) -> Result<Self> { |
| 747 | let rhs = other.borrow(); |
| 748 | let (lhs_owned, rhs_owned) = coerce_for_comparison(self, rhs)?; |
| 749 | let lhs = lhs_owned.as_ref().unwrap_or(self); |
| 750 | let rhs = rhs_owned.as_ref().unwrap_or(rhs); |
| 751 | |
| 752 | match lhs.intersect(rhs)? { |
| 753 | Some(intersection) => { |
| 754 | if &intersection == rhs { |
| 755 | Ok(Self::TRUE) |
| 756 | } else { |
| 757 | Ok(Self::TRUE_OR_FALSE) |
| 758 | } |
| 759 | } |
| 760 | None => Ok(Self::FALSE), |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | /// Decide if this interval is a superset of `other`. If argument `strict` |
| 765 | /// is `true`, only returns `true` if this interval is a strict superset. |
no test coverage detected