use super::super::traits::binop;
use super::super::traits::max;
use std::fmt::Debug;
use binop::{Associative, Commutative, Identity, Magma};
use max::Max;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OpMin<T> {
OpMinV,
_Marker(T),
}
pub use OpMin::OpMinV;
impl<T> Default for OpMin<T> {
fn default() -> Self { OpMinV }
}
impl<T> Magma for OpMin<T>
where
T: Ord + Eq + Sized,
{
type Set = T;
fn op(&self, x: Self::Set, y: Self::Set) -> Self::Set { x.min(y) }
}
impl<T> Identity for OpMin<T>
where
T: Ord + Eq + Sized + Max,
{
fn id(&self) -> Self::Set { <T as Max>::max() }
}
impl<T> Associative for OpMin<T> where T: Ord + Eq + Sized {}
impl<T> Commutative for OpMin<T> where T: Ord + Eq + Sized {}