add the is_valid trait default method

This commit is contained in:
ripytide
2023-06-25 20:47:46 +01:00
parent 354815809b
commit 176c39f58c
+7
View File
@@ -1418,6 +1418,13 @@ pub trait InclusiveRange<I> {
point >= self.start() && point <= self.end()
}
fn is_valid(&self) -> bool
where
I: Ord,
{
self.start() <= self.end()
}
///requires that self comes before other and they don't overlap
fn touches_ordered(&self, other: &Self) -> bool
where