1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
pub use tea_codec_macros::Priced;
#[rustc_specialization_trait]
pub trait Priced {
fn price(&self) -> Option<u64>;
}
pub trait PricedOrDefault {
fn price(&self) -> Option<u64>;
}
impl<T> PricedOrDefault for T {
default fn price(&self) -> Option<u64> {
None
}
}
impl<T> PricedOrDefault for T
where
T: Priced,
{
fn price(&self) -> Option<u64> {
Priced::price(self)
}
}