Skip to main content

excel_cli/actions/
cell.rs

1use super::{ActionType, Command};
2use crate::excel::Cell;
3
4#[derive(Clone)]
5pub struct CellAction {
6    pub sheet_index: usize,
7    pub sheet_name: String,
8    pub row: usize,
9    pub col: usize,
10    pub old_value: Cell,
11    pub new_value: Cell,
12    pub action_type: ActionType,
13}
14
15impl CellAction {
16    #[must_use]
17    pub fn new(
18        sheet_index: usize,
19        sheet_name: String,
20        row: usize,
21        col: usize,
22        old_value: Cell,
23        new_value: Cell,
24        action_type: ActionType,
25    ) -> Self {
26        Self {
27            sheet_index,
28            sheet_name,
29            row,
30            col,
31            old_value,
32            new_value,
33            action_type,
34        }
35    }
36}
37
38impl Command for CellAction {
39    fn action_type(&self) -> ActionType {
40        self.action_type.clone()
41    }
42}