Trait proj_billing::billing::consumption::Consumption [] [src]

pub trait Consumption<Cons, Other> {
    type Prices;
    fn new(cons: Cons, other: Other) -> Self;
    fn is_valid(&self) -> bool;
    fn null_prices() -> Self::Prices;
    fn set_price(prices: &mut Self::Prices, other: Other, price: Cons);
    fn get_price(prices: &Self::Prices, other: Other) -> Cons;
    fn prices_len() -> usize;
    fn cons_from_bytes(bytes: &[u8]) -> Cons;
    fn prices_from_bytes(bytes: &[u8]) -> Self::Prices;
    fn prices_to_bytes(prices: &Self::Prices) -> Vec<u8>;
}

Note that Cons doubles as the type of the price per cons, just to keep things simple

Associated Types

Co-efficients for the number of consumption units for each hour of day each week

Required Methods

Instance new HourlyConsumption

Check the validity of an HourlyConsumption

Make an empty prices object

Set Price for a particular other

Get Price of a particular other

Length of a Prices

Cons from raw bytes

Prices from raw bytes

Prices to raw bytes

Implementors