Compare value.

This commit is contained in:
Tom Alexander
2023-10-02 23:28:32 -04:00
parent 29d9e76545
commit 8169499de3
4 changed files with 55 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ pub struct Paragraph<'s> {
#[derive(Debug)]
pub struct Comment<'s> {
pub source: &'s str,
pub value: Vec<&'s str>,
}
#[derive(Debug)]
@@ -209,3 +210,15 @@ impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
self.source
}
}
impl<'s> Comment<'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 {
ret.push_str(line);
}
ret
}
}