Skip to main content

allen_intervals/relation/
finishes.rs

1/// Methods for checking for a "finishes" relation between intervals.
2pub trait Finishes<T>: Sized {
3    /// Returns `true` iff `self` finishes `other.0.
4    ///
5    /// ```plain
6    /// self:          ┌────────┐
7    /// other: └────────────────┘
8    /// ```
9    #[inline]
10    fn finishes(&self, _other: &T) -> bool {
11        false
12    }
13
14    /// Returns `true` iff `self` is finished by `other.0.
15    ///
16    /// ```plain
17    /// self:  ┌────────────────┐
18    /// other:         └────────┘
19    /// ```
20    #[inline]
21    fn is_finished_by(&self, other: &T) -> bool
22    where
23        T: Finishes<Self>,
24    {
25        other.finishes(self)
26    }
27}