Conversation
src/hdu/header/extension/bintable.rs
Outdated
|
|
||
| for i in 1..=z_naxis { | ||
| let naxisn = if let Ok(value) = values.get_parsed::<i64>(&format!("ZNAXIS{i}")) { | ||
| let naxisn = if let Ok(value) = values.check_for_naxisi(i) { |
There was a problem hiding this comment.
I just had to restore that line which made the parsing of compressed tile images failing but otherwise everything worked well and this is very a nice feature. I also learned things thank you. This reduces the number of cast of card values in many aspects.
There was a problem hiding this comment.
Oh, yeah, my bad - didn't notice it was NAXIS vs ZNAXIS. Thanks for catching it and glad you like the feature itself :)
|
Btw, I was thinking that it would be great to add Serde support to bintables / asciitables - with It's a much bigger task than implementing Serde for headers like I did here though, and I won't have much time for it at the moment. Just thought I'd mention in case it's something you're interested in looking into. |
Inspired by similar integration in rust-fitsio, I've implemented Serde integration for FITS headers and individual values.
This allows to parse arbitrary types instead of doing manual casts everywhere, as well as declaratively describe complex structures. For most notable demo, see the amount of removed code in
wcs.rs-WCSParamsalready derivesDeserialize, so now that we implementDeserializer, it's pretty trivial to connect the two.For custom field extractions, I've also wrapped
HashMap<String, Value>into a newValueMaptype which encapsulatesIndexMap<String, Value>(to get consistent iteration order, something that didn't work correctly before) as well as all the previously existing helper methods that don't need the wholeHeader.