excel_cli/actions/
cell.rs1use super::{ActionType, Command};
2use crate::excel::Cell;
3use anyhow::Result;
4
5#[derive(Clone)]
6pub struct CellAction {
7 pub sheet_index: usize,
8 pub sheet_name: String,
9 pub row: usize,
10 pub col: usize,
11 pub old_value: Cell,
12 pub new_value: Cell,
13 pub action_type: ActionType,
14}
15
16impl CellAction {
17 #[must_use]
18 pub fn new(
19 sheet_index: usize,
20 sheet_name: String,
21 row: usize,
22 col: usize,
23 old_value: Cell,
24 new_value: Cell,
25 action_type: ActionType,
26 ) -> Self {
27 Self {
28 sheet_index,
29 sheet_name,
30 row,
31 col,
32 old_value,
33 new_value,
34 action_type,
35 }
36 }
37}
38
39impl Command for CellAction {
40 fn execute(&self) -> Result<()> {
41 unimplemented!("Requires an ActionExecutor implementation")
42 }
43
44 fn undo(&self) -> Result<()> {
45 unimplemented!("Requires an ActionExecutor implementation")
46 }
47
48 fn action_type(&self) -> ActionType {
49 self.action_type.clone()
50 }
51}