use crate::{traits::IntoGeneral, Bound, BoundType, Exclusive, Inclusive, Interval};
impl<T> From<T> for Bound<T, Inclusive> {
fn from(t: T) -> Self {
Self {
limit: t,
bound_type: Inclusive,
}
}
}
impl<T> From<T> for Bound<T, Exclusive> {
fn from(t: T) -> Self {
Self {
limit: t,
bound_type: Exclusive,
}
}
}
impl<T> From<Interval<T, Inclusive>> for Interval<T, BoundType> {
fn from(i: Interval<T, Inclusive>) -> Self {
i.into_general()
}
}
impl<T> From<Interval<T, Exclusive>> for Interval<T, BoundType> {
fn from(i: Interval<T, Exclusive>) -> Self {
i.into_general()
}
}
impl<T> From<Interval<T, Inclusive, Exclusive>> for Interval<T, BoundType> {
fn from(i: Interval<T, Inclusive, Exclusive>) -> Self {
i.into_general()
}
}
impl<T> From<Interval<T, Exclusive, Inclusive>> for Interval<T, BoundType> {
fn from(i: Interval<T, Exclusive, Inclusive>) -> Self {
i.into_general()
}
}
impl<T: PartialOrd + Clone> From<T> for Interval<T, Inclusive> {
fn from(t: T) -> Self {
Self::new(t.clone().into(), t.into())
}
}