Create structure for timestamps.

This commit is contained in:
Tom Alexander
2023-07-24 17:34:07 -04:00
parent 73e15286dc
commit fa5fc41121
6 changed files with 59 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ pub enum Object<'s> {
StatisticsCookie(StatisticsCookie<'s>),
Subscript(Subscript<'s>),
Superscript(Superscript<'s>),
Timestamp(Timestamp<'s>),
}
#[derive(Debug, PartialEq)]
@@ -179,6 +180,11 @@ pub struct Superscript<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct Timestamp<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -205,6 +211,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::InlineSourceBlock(obj) => obj.source,
Object::LineBreak(obj) => obj.source,
Object::Target(obj) => obj.source,
Object::Timestamp(obj) => obj.source,
Object::StatisticsCookie(obj) => obj.source,
Object::Subscript(obj) => obj.source,
Object::Superscript(obj) => obj.source,
@@ -361,3 +368,9 @@ impl<'s> Source<'s> for Superscript<'s> {
self.source
}
}
impl<'s> Source<'s> for Timestamp<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}