use core::fmt::Debug;
use core::ops::{Add, BitAnd, BitOr, BitXor, Mul, Not, Sub};
use num_traits::{One, Zero};
use super::{Prefix, Range};
#[allow(clippy::trait_duplication_in_bounds)]
pub trait Set<'a>:
Debug
+ Clone
+ Default
+ Extend<Self::Prefix>
+ FromIterator<Self::Prefix>
+ Extend<Self::Range>
+ FromIterator<Self::Range>
+ One
+ Zero
+ PartialEq
+ Eq
+ PartialOrd
+ BitAnd<Output = Self>
+ BitOr<Output = Self>
+ BitXor<Output = Self>
+ Not<Output = Self>
+ Add<Output = Self>
+ Mul<Output = Self>
+ Sub<Output = Self>
{
type Prefix: Prefix;
type Range: Range<Prefix = Self::Prefix>;
type Prefixes: Iterator<Item = Self::Prefix>;
type Ranges: Iterator<Item = Self::Range>;
fn contains(&self, prefix: Self::Prefix) -> bool;
fn prefixes(&'a self) -> Self::Prefixes;
fn ranges(&'a self) -> Self::Ranges;
#[must_use]
fn any() -> Self {
Self::one()
}
#[must_use]
fn len(&'a self) -> usize {
self.prefixes().count()
}
#[must_use]
fn is_empty(&'a self) -> bool {
self.ranges().count() == 0
}
}