Skip to main content

runmat_mir/
indexing.rs

1use crate::MirOperand;
2use runmat_hir::{IndexKind, IndexResultContext};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct MirIndexing {
7    pub kind: IndexKind,
8    pub plan: MirIndexPlan,
9    pub components: Vec<MirIndexComponent>,
10    pub result_context: IndexResultContext,
11    #[serde(default)]
12    pub cell_expand_all: bool,
13}
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
16pub enum MirIndexPlan {
17    Scalar,
18    Slice,
19    SliceExpr,
20    Cell,
21}
22
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
24pub enum MirIndexComponent {
25    Colon,
26    End { dim: Option<usize>, offset: isize },
27    Expr(MirOperand),
28}