logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::*;
use crate::util::*;

/// A collection of terms
#[derive(Clone, PartialEq, PartialOrd, Serialize)]
pub struct Terms(std::collections::BTreeSet<Term>);

impl std::fmt::Debug for Terms {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        self.0.fmt(f)
    }
}

impl<T> From<T> for Terms
where
    T: IntoIterator,
    T::Item: Into<Term>,
{
    fn from(value: T) -> Self {
        Self(value.into_iter().map(Into::into).collect())
    }
}

impl ShouldSkip for Terms {
    fn should_skip(&self) -> bool {
        self.0.is_empty()
    }
}