pub struct CellAddr {
pub col: u32,
pub row: u32,
pub col_abs: bool,
pub row_abs: bool,
}Expand description
A1-style cell address with 1-based column and row, plus per-axis $
(absolute-reference) markers.
A1 → CellAddr::new(1, 1), BC42 → CellAddr::new(55, 42),
$A$1 → CellAddr::new(1, 1).with_col_abs(true).with_row_abs(true).
Fields§
§col: u321-based column index (A = 1, Z = 26, AA = 27).
row: u321-based row index.
col_abs: booltrue if the column was written with a $ anchor ($A1, $A$1).
row_abs: booltrue if the row was written with a $ anchor (A$1, $A$1).
Implementations§
Source§impl CellAddr
impl CellAddr
Sourcepub const fn new(col: u32, row: u32) -> Self
pub const fn new(col: u32, row: u32) -> Self
A relative address (no $ on either axis) — the common case.
Sourcepub const fn with_col_abs(self, abs: bool) -> Self
pub const fn with_col_abs(self, abs: bool) -> Self
Set whether the column is $-anchored.
Sourcepub const fn with_row_abs(self, abs: bool) -> Self
pub const fn with_row_abs(self, abs: bool) -> Self
Set whether the row is $-anchored.
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
Parse an A1-style address (case-insensitive): an optional $, column
letters, an optional $, then row digits. A $ before the letters
marks the column absolute; a $ before the digits marks the row
absolute.
Returns None for anything else (empty column/row part, row 0,
trailing characters, malformed $ placement, or out-of-range values).