umya-spreadsheet icon indicating copy to clipboard operation
umya-spreadsheet copied to clipboard

Hope the public field value has_value method.

Open tzfun opened this issue 3 months ago • 1 comments

I found that the structures packaged in the library are all expressed in the form of xxxValue. The external access method (get_xxx) provided by the structure is to directly read the value of the field or its default value. This is indeed sufficient in most cases, but it is not enough in some scenarios. For example, in the Color structure, calling the get_indexed and get_theme_index methods both return 0, but in fact indexed is None and theme_index is Some(0). I cannot use the existing external access method to know whether the field is Some or None.

pub struct Color {
    indexed: UInt32Value,
    theme_index: UInt32Value,
    argb: StringValue,
    tint: DoubleValue,
}

impl Color {
...

  #[inline]
    pub fn get_indexed(&self) -> &u32 {
        self.indexed.get_value()
    }

   #[inline]
    pub fn get_theme_index(&self) -> &u32 {
        self.theme_index.get_value()
    }

...
}

It would be great if the has_value method of xxxValue could be exposed in the structure. I hope the author will adopt it. Thank you!

Best wishes

tzfun avatar Sep 03 '25 03:09 tzfun