tktax_histogram/
histogram_display_strategy.rs

1// ---------------- [ File: tktax-histogram/src/histogram_display_strategy.rs ]
2crate::ix!();
3
4#[derive(Debug,Clone)]
5pub enum HistogramDisplayStrategy {
6    Short,
7    ShowTransactionsInBinsWithManyItems {
8        threshold_item_count_in_bin: usize,
9    },
10    ShowHeavyTransactionsBasedOnPrice { 
11        maybe_price_threshold: Option<MonetaryAmount>,
12    },
13}
14
15impl Default for HistogramDisplayStrategy {
16
17    fn default() -> Self {
18
19        // best to just show all, probably
20        Self::show_full_histogram()
21    }
22}
23
24impl HistogramDisplayStrategy {
25
26    pub fn show_full_histogram() -> Self {
27
28        HistogramDisplayStrategy::ShowHeavyTransactionsBasedOnPrice { 
29            maybe_price_threshold: None
30        }
31    }
32
33    pub fn with_price_threshold(x: f64) -> Self {
34
35        HistogramDisplayStrategy::ShowHeavyTransactionsBasedOnPrice { 
36            maybe_price_threshold: Some(MonetaryAmount::from(x)) 
37        }
38    }
39}