cleanup getting docs for symbol

This commit is contained in:
faldor20 2024-03-12 00:13:57 +10:00
parent 321baf86d1
commit ee264981b6
No known key found for this signature in database
GPG key ID: F2216079B890CD57
2 changed files with 12 additions and 19 deletions

View file

@ -17,6 +17,14 @@ pub struct ModuleDocumentation {
pub scope: Scope,
pub exposed_symbols: VecSet<Symbol>,
}
impl ModuleDocumentation {
pub fn get_doc_for_symbol(&self, symb: &Symbol) -> Option<String> {
self.entries.iter().find_map(|doc| match doc {
DocEntry::DocDef(DocDef { symbol, docs, .. }) if symbol == symb => docs.clone(),
_ => None,
})
}
}
#[derive(Debug, Clone)]
pub enum DocEntry {