Skip to content

Commit

Permalink
cds-astro#9 keyword and card iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
chrsoo committed Dec 28, 2024
1 parent 5609d8f commit 4bee550
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/hdu/header/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use serde::Serialize;

pub mod extension;

use std::collections::HashMap;
use std::collections::hash_map::Keys;
use std::collections::{
hash_map::Iter, HashMap
};
use std::io::Read;

use crate::card::*;
Expand Down Expand Up @@ -256,6 +259,18 @@ where
})
})
}

pub fn keywords(&self) -> Keys<Keyword,Value> {
self.cards.keys()
}

pub fn cards(&self) -> impl Iterator<Item = Card> + use<'_, X> {
self.cards.iter()
.map(|(kw,v)| {
Card { kw: kw.to_owned(), v: v.to_owned() }
})
}

}

fn parse_pcount_card(card: &[u8; 80]) -> Result<usize, Error> {
Expand Down

0 comments on commit 4bee550

Please sign in to comment.