formualizer_eval/engine/
named_range.rs1use formualizer_parse::ASTNode;
2use rustc_hash::FxHashSet;
3
4use formualizer_common::LiteralValue;
5
6use crate::{CellRef, RangeRef, SheetId, engine::VertexId, reference::SharedRangeRef};
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
10pub enum NameScope {
11 Workbook,
13 Sheet(SheetId),
15}
16
17#[derive(Debug, Clone, PartialEq)]
19#[allow(clippy::large_enum_variant)]
20pub enum NamedDefinition {
21 Cell(CellRef),
23 Range(RangeRef),
25 Literal(LiteralValue),
27 Formula {
29 ast: ASTNode,
30 dependencies: Vec<VertexId>,
32 range_deps: Vec<SharedRangeRef<'static>>,
34 },
35}
36
37#[derive(Debug, Clone)]
39pub struct NamedRange {
40 pub definition: NamedDefinition,
41 pub scope: NameScope,
42 pub dependents: FxHashSet<VertexId>,
44 pub vertex: VertexId,
46}
47
48#[derive(Debug, Clone, PartialEq)]
50pub struct NamedRangeSnapshot {
51 pub name: String,
52 pub scope: NameScope,
53 pub definition: NamedDefinition,
54}