Skip to main content

wagyu_model/
amount.rs

1use std::{
2    fmt::{Debug, Display},
3    hash::Hash,
4};
5
6/// The interface for a generic amount.
7pub trait Amount: Copy + Clone + Debug + Display + Send + Sync + 'static + Eq + Ord + Sized + Hash {}
8
9#[derive(Debug, Fail)]
10pub enum AmountError {
11    #[fail(display = "the amount: {} exceeds the supply bounds of {}", _0, _1)]
12    AmountOutOfBounds(String, String),
13
14    #[fail(display = "{}: {}", _0, _1)]
15    Crate(&'static str, String),
16
17    #[fail(display = "invalid amount: {}", _0)]
18    InvalidAmount(String),
19}