use rustdoc_types::{Crate, Id, Item};
pub struct CrateWrapper<'c> {
crate_: &'c Crate,
missing_ids: Vec<&'c Id>,
}
impl<'c> CrateWrapper<'c> {
pub fn new(crate_: &'c Crate) -> Self {
Self {
crate_,
missing_ids: vec![],
}
}
pub fn get_item(&mut self, id: &'c Id) -> Option<&'c Item> {
self.crate_.index.get(id).or_else(|| {
self.missing_ids.push(id);
None
})
}
pub fn missing_item_ids(&self) -> Vec<String> {
self.missing_ids.iter().map(|m| m.0.clone()).collect()
}
}