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
type Prices
Co-efficients for the number of consumption units for each hour of day each week
Required Methods
fn new(cons: Cons, other: Other) -> Self
Instance new HourlyConsumption
fn is_valid(&self) -> bool
Check the validity of an HourlyConsumption
fn null_prices() -> Self::Prices
Make an empty prices object
fn set_price(prices: &mut Self::Prices, other: Other, price: Cons)
Set Price for a particular other
fn get_price(prices: &Self::Prices, other: Other) -> Cons
Get Price of a particular other
fn prices_len() -> usize
Length of a Prices
fn cons_from_bytes(bytes: &[u8]) -> Cons
Cons from raw bytes
fn prices_from_bytes(bytes: &[u8]) -> Self::Prices
Prices from raw bytes
fn prices_to_bytes(prices: &Self::Prices) -> Vec<u8>
Prices to raw bytes
Implementors
impl Consumption<f32, u8> for FloatingConsumption
impl Consumption<i32, u64> for IntegerConsumption