A very simple GetAffiliatedKeywords trait.

This commit is contained in:
Tom Alexander
2023-10-11 12:19:27 -04:00
parent c4cc40f5e1
commit 8e0a7dea0f
4 changed files with 12 additions and 27 deletions

View File

@@ -19,3 +19,7 @@ pub struct AffiliatedKeyword<'s> {
pub struct AffiliatedKeywords<'s> {
pub(crate) keywords: BTreeMap<&'s str, AffiliatedKeywordValue<'s>>,
}
pub trait GetAffiliatedKeywords<'s> {
fn get_affiliated_keywords<'a>(&'a self) -> &'a AffiliatedKeywords<'s>;
}

View File

@@ -1,3 +1,4 @@
use super::affiliated_keyword::GetAffiliatedKeywords;
use super::element::Element;
use super::lesser_element::TableCell;
use super::AffiliatedKeywords;
@@ -220,3 +221,9 @@ impl<'s> TableRow<'s> {
}
}
}
impl<'s> GetAffiliatedKeywords<'s> for PlainList<'s> {
fn get_affiliated_keywords<'a>(&'a self) -> &'a AffiliatedKeywords<'s> {
&self.affiliated_keywords
}
}

View File

@@ -13,6 +13,7 @@ mod util;
pub use affiliated_keyword::AffiliatedKeyword;
pub use affiliated_keyword::AffiliatedKeywordValue;
pub use affiliated_keyword::AffiliatedKeywords;
pub use affiliated_keyword::GetAffiliatedKeywords;
pub(crate) use ast_node::AstNode;
pub use document::Document;
pub use document::DocumentElement;