You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
551 B

use std::ops::RangeInclusive;
#[derive(Clone,Debug,PartialEq,Eq,Hash)]
pub enum Definition
{
Single(RangeInclusive<usize>),
Any,
None,
}
impl Definition
{
pub const fn single(idx: RangeInclusive<usize>) -> Self
{
Self::Single(idx)
}
pub const fn any() -> Self
{
Self::Any
}
pub const fn none() -> Self
{
Self::None
}
pub fn contains(&self, sz: usize) -> bool
{
use Definition::*;
match self {
Single(range) => range.contains(&sz),
Any => true,
_ => false,
}
}
}