Compare value.

This commit is contained in:
Tom Alexander
2023-10-05 03:58:42 -04:00
parent 34a0858473
commit 18ad80e018
3 changed files with 51 additions and 18 deletions

View File

@@ -117,6 +117,7 @@ pub struct Planning<'s> {
pub struct FixedWidthArea<'s> {
pub source: &'s str,
pub name: Option<&'s str>,
pub value: Vec<&'s str>,
}
#[derive(Debug)]
@@ -267,7 +268,18 @@ impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
impl<'s> Comment<'s> {
pub fn get_value(&self) -> String {
// TODO: maybe we should handle parsing here instead of storing the parsing result in the AST since I imagine getting the value of comments won't be a common operation.
let final_size = self.value.iter().map(|line| line.len()).sum();
let mut ret = String::with_capacity(final_size);
for line in &self.value {
ret.push_str(line);
}
ret
}
}
impl<'s> FixedWidthArea<'s> {
pub fn get_value(&self) -> String {
let final_size = self.value.iter().map(|line| line.len()).sum();
let mut ret = String::with_capacity(final_size);
for line in &self.value {