A very simple GetAffiliatedKeywords trait.
This commit is contained in:
parent
c4cc40f5e1
commit
8e0a7dea0f
@ -9,7 +9,6 @@ use crate::compare::diff::compare_ast_node;
|
||||
use crate::compare::sexp::unquote;
|
||||
use crate::types::AstNode;
|
||||
use crate::types::GetStandardProperties;
|
||||
use crate::types::Keyword;
|
||||
use crate::types::StandardProperties;
|
||||
|
||||
/// Check if the child string slice is a slice of the parent string slice.
|
||||
@ -338,29 +337,3 @@ where
|
||||
}
|
||||
Ok(ComparePropertiesResult::NoChange)
|
||||
}
|
||||
|
||||
// pub(crate) fn compare_affiliated_keywords<'b, 's, RK, RV, RI>(
|
||||
// emacs: &'b Token<'s>,
|
||||
// rust_children: RI,
|
||||
// ) -> Result<ComparePropertiesResult<'b, 's>, Box<dyn std::error::Error>>
|
||||
// where
|
||||
// RI: Iterator<Item = &'b Keyword<'s>> + ExactSizeIterator,
|
||||
// {
|
||||
// for kw in rust_children {
|
||||
|
||||
// }
|
||||
// for (rust_key, rust_value) in rust_children {
|
||||
// let rust_key = rust_key.as_ref();
|
||||
// let rust_value = rust_value.as_ref();
|
||||
// let emacs_value = get_property_quoted_string(emacs, rust_key)?;
|
||||
// if Some(rust_value) != emacs_value.as_ref().map(String::as_str) {
|
||||
// let this_status = DiffStatus::Bad;
|
||||
// let message = Some(format!(
|
||||
// "{} mismatch (emacs != rust) {:?} != {:?}",
|
||||
// rust_key, emacs_value, rust_value
|
||||
// ));
|
||||
// return Ok(ComparePropertiesResult::SelfChange(this_status, message));
|
||||
// }
|
||||
// }
|
||||
// Ok(ComparePropertiesResult::NoChange)
|
||||
// }
|
||||
|
@ -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>;
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user