use std::ops::{Add, Sub};
use num_traits::Zero;
pub trait AddSubSelf {
fn add(&self, other: &Self) -> Self;
fn sub(&self, other: &Self) -> Self;
}
impl<T> AddSubSelf for T
where
T: Add<Output = T> + Sub<Output = T> + Copy,
{
fn add(&self, other: &Self) -> Self {
*self + *other
}
fn sub(&self, other: &Self) -> Self {
*self - *other
}
}
pub trait Bid {
type Name: Eq;
type Value: Ord + AddSubSelf + Zero;
type Item: Eq;
type Quantity: PartialOrd + AddSubSelf + Zero + Clone;
fn bidder_name(&self) -> &Self::Name;
fn bid_value(&self) -> &Self::Value;
fn bid_items(&self) -> &[(Self::Item, Self::Quantity)];
}