tktax_histogram/
histogram.rs1crate::ix!();
3
4#[derive(Getters,Debug)]
5#[getset(get="pub")]
6pub struct AccountHistogram {
7 strategy: HistogramDisplayStrategy,
8 months: Vec<HistogramMonth>,
9}
10
11impl AccountHistogram {
12
13 pub fn new(strategy: &HistogramDisplayStrategy) -> Self {
14 Self {
15 strategy: strategy.clone(),
16 months: vec![],
17 }
18 }
19
20 pub fn push(&mut self, histogram_month: HistogramMonth) {
21 self.months.push(histogram_month);
22 }
23}
24
25impl fmt::Display for AccountHistogram {
26
27 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28
29 for month in &self.months {
30
31 month.fmt_with(f, &self.strategy)?;
32
33 if month != self.months.last().unwrap() {
34
35 writeln!(f, "________________________________")?;
36
37 } else {
38
39 writeln!(f, " ")?;
41 }
42 }
43
44 write!(f, "")
45 }
46}