tktax-histogram 0.2.2

A Rust crate that provides robust monthly histogram utilities for financial transactions, using specialized types from the TKTAX ecosystem.
Documentation
// ---------------- [ File: tktax-histogram/src/histogram_display_strategy.rs ]
crate::ix!();

#[derive(Debug,Clone)]
pub enum HistogramDisplayStrategy {
    Short,
    ShowTransactionsInBinsWithManyItems {
        threshold_item_count_in_bin: usize,
    },
    ShowHeavyTransactionsBasedOnPrice { 
        maybe_price_threshold: Option<MonetaryAmount>,
    },
}

impl Default for HistogramDisplayStrategy {

    fn default() -> Self {

        // best to just show all, probably
        Self::show_full_histogram()
    }
}

impl HistogramDisplayStrategy {

    pub fn show_full_histogram() -> Self {

        HistogramDisplayStrategy::ShowHeavyTransactionsBasedOnPrice { 
            maybe_price_threshold: None
        }
    }

    pub fn with_price_threshold(x: f64) -> Self {

        HistogramDisplayStrategy::ShowHeavyTransactionsBasedOnPrice { 
            maybe_price_threshold: Some(MonetaryAmount::from(x)) 
        }
    }
}