buguoshixc/mooncalc/src/value does not have a README file

    CellAddr

    pub(all) struct CellAddr {
    row : Int
    col : Int
    abs_row : Bool
    abs_col : Bool
    } derive(Eq, Show,
    Debug
    )
    单元格地址:1 基行列 + $ 绝对标记。用 parse_addr 从 "A1"/"$B$2" 解析。

    CellAddr::key

    fn CellAddr::key(self : CellAddr) -> String
    网格键:不带 $ 的大写 A1 形式(如 "B1"),是 Grid.cells 的键格式。

    CellAddr::to_string

    fn CellAddr::to_string(self : CellAddr) -> String
    带 $ 绝对标记的 A1 形式文本,如 {row:1,col:2,abs_row:true,abs_col:true} → "$B$1"。

    RangeValue

    pub(all) struct RangeValue {
    rows : Int
    cols : Int
    cells : Array[Value]
    } derive(Eq, Show,
    Debug
    )
    行主序的区域值:rows × cols,cells 按行优先展开(长度 = rows × cols)。

    Value

    pub(all) enum Value {
    Num(Double)
    Text(String)
    Bool(Bool)
    Err(XlError)
    Blank
    Range(RangeValue)
    } derive(Eq, Show,
    Debug
    )
    单元格的值。公式结果不会是真空白:输出边界把 Blank 归一为 Num(0); Blank 只作为网格输入状态存在。

    Value::type_name

    fn Value::type_name(self : Value) -> String
    值的类型名("number"/"text"/"bool"/"error"/"blank"/"range"),用于错误消息与调试。

    XlError

    pub(all) enum XlError {
    Div0
    NA
    Name
    Null
    Num
    Ref
    Value
    Calc
    } derive(Eq, Show,
    Debug
    )
    Excel 错误值。求值阶段的错误作为 Value::Err 传播,与解析错误(ParseError)是两条独立通道。

    XlError::parse

    fn XlError::parse(s : String) -> XlError?
    从 Excel 文本(如 "#DIV/0!")解析错误值;无法识别返回 None。

    XlError::to_string

    fn XlError::to_string(self : XlError) -> String
    错误值的 Excel 文本表示,如 Div0 → "#DIV/0!"。

    ascii_lower

    fn ascii_lower(s : String) -> String
    仅 ASCII 范围的小写化(非 ASCII 字符不变)。

    ascii_upper

    fn ascii_upper(s : String) -> String
    仅 ASCII 范围的大写化(函数名归一化用;非 ASCII 字符不变)。

    excel_precision

    fn excel_precision(d : Double) -> Double
    Excel 录入精度:数字最多 15 位有效十进制数字,超出部分直接置零(不四舍五入), 如 123456789012345678 → 123456789012345000。非有限值与 0 原样返回。

    is_ascii_digit

    fn is_ascii_digit(c : Char) -> Bool
    ASCII 数字(0-9)。

    is_ascii_letter

    fn is_ascii_letter(c : Char) -> Bool
    ASCII 字母(A-Z / a-z)。

    max_col

    let max_col : Int
    Excel 最大列号(16384,XFD)。

    max_row

    let max_row : Int
    Excel 最大行号(1048576)。

    parse_addr

    fn parse_addr(s : String) -> CellAddr?
    解析 A1 形式地址(大小写不敏感,支持 $ 绝对标记);非法或越界(行 >1048576、列 >16384)返回 None。

    unicode_lower

    fn unicode_lower(s : String) -> String
    Excel LOWER:逐字符 Unicode 简单小写映射(不做展开,如 LOWER("İ") = "i")。

    unicode_upper

    fn unicode_upper(s : String) -> String
    Excel UPPER:逐字符 Unicode 简单大写映射(不做展开,如 UPPER("straße") = "STRAßE")。

    Source Files