-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterate over all cards in a header #9
Comments
Hi @chrsoo, Thank you, I merged the PR with 2,3 unrelated things (git-lfs removal among others). I added a test retrieving calling cards iter. I realize Keyword may not be very friendly from the user perspective. As a minor future update, would it be better to have a proper Keyword type being just a [u8; 8] that has a method to get its owned String trimmed value (the method you made on Card) ? What do you think ? |
Great, thanks! I just realised that the Card method really should have been a &str like so: impl Card {
...
/// Return the ASCII trimmed keyword.
pub fn keyword(&self) -> Result<&str, std::str::Utf8Error> {
std::str::from_utf8(self.kw.trim_ascii())
}
} No point in copying the buffer if an owned value is not needed. If an owned value is needed there is Regarding The convenience method I added is only half-way as a keyword should be infallible. Per the FITS standard the whole header must conform to valid ASCII. Should the UTF8 conversion fail all the same, I think the header record should be ignored and a parser error logged or written to stderr. |
Hi,
From what I can tell the
fitsrs
library only supports retrieving Cards of a Header by Keyword.Is this correct or is there a way of iterate over all Cards in Header that does not assume prior knowledge of the possible Keywords?
The text was updated successfully, but these errors were encountered: