use core::Card;
use std::fmt::Debug;
use std::ops::Range;
pub trait Space {
type Value: Debug + Clone;
fn dim(&self) -> usize;
fn card(&self) -> Card;
}
impl<D: Space> Space for Box<D> {
type Value = D::Value;
fn dim(&self) -> usize { (**self).dim() }
fn card(&self) -> Card { (**self).card() }
}
impl<'a, D: Space> Space for &'a D {
type Value = D::Value;
fn dim(&self) -> usize { (**self).dim() }
fn card(&self) -> Card { (**self).card() }
}
pub trait BoundedSpace: Space
where Self::Value: PartialOrd
{
type BoundValue: PartialOrd + Copy;
fn inf(&self) -> Option<Self::BoundValue>;
fn sup(&self) -> Option<Self::BoundValue>;
fn contains(&self, val: Self::BoundValue) -> bool;
}
pub trait FiniteSpace: BoundedSpace
where Self::Value: PartialOrd
{
fn range(&self) -> Range<Self::Value>;
}