manabrew_engine/zone/
cost_payment_stack.rs1#[derive(Debug, Clone, Default)]
9pub struct CostPaymentStack {
10 stack: Vec<CostPaymentEntry>,
11}
12
13#[derive(Debug, Clone)]
15pub struct CostPaymentEntry {
16 pub cost_description: String,
17}
18
19impl CostPaymentStack {
20 pub fn new() -> Self {
21 CostPaymentStack { stack: Vec::new() }
22 }
23
24 pub fn push(&mut self, entry: CostPaymentEntry) {
25 self.stack.push(entry);
26 }
27
28 pub fn pop(&mut self) -> Option<CostPaymentEntry> {
29 self.stack.pop()
30 }
31
32 pub fn peek(&self) -> Option<&CostPaymentEntry> {
33 self.stack.last()
34 }
35
36 pub fn clear(&mut self) {
37 self.stack.clear();
38 }
39
40 pub fn iter(&self) -> impl Iterator<Item = &CostPaymentEntry> {
41 self.stack.iter()
42 }
43
44 pub fn iterator(&self) -> impl Iterator<Item = &CostPaymentEntry> {
47 self.stack.iter()
48 }
49}