Create structure for statistics cookies.

This commit is contained in:
Tom Alexander
2023-07-22 01:49:07 -04:00
parent abb0aeacaf
commit c73e26e2d6
5 changed files with 54 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ pub enum Object<'s> {
InlineSourceBlock(InlineSourceBlock<'s>),
LineBreak(LineBreak<'s>),
Target(Target<'s>),
StatisticsCookie(StatisticsCookie<'s>),
}
#[derive(Debug, PartialEq)]
@@ -161,6 +162,11 @@ pub struct Target<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct StatisticsCookie<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -187,6 +193,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::InlineSourceBlock(obj) => obj.source,
Object::LineBreak(obj) => obj.source,
Object::Target(obj) => obj.source,
Object::StatisticsCookie(obj) => obj.source,
}
}
}
@@ -322,3 +329,9 @@ impl<'s> Source<'s> for Target<'s> {
self.source
}
}
impl<'s> Source<'s> for StatisticsCookie<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}