Create structure for entities.
This commit is contained in:
@@ -15,6 +15,7 @@ pub enum Object<'s> {
|
||||
PlainLink(PlainLink<'s>),
|
||||
AngleLink(AngleLink<'s>),
|
||||
OrgMacro(OrgMacro<'s>),
|
||||
Entity(Entity<'s>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -96,6 +97,12 @@ pub struct OrgMacro<'s> {
|
||||
pub macro_args: Vec<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Entity<'s> {
|
||||
pub source: &'s str,
|
||||
pub entity_name: &'s str,
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Object<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
match self {
|
||||
@@ -112,6 +119,7 @@ impl<'s> Source<'s> for Object<'s> {
|
||||
Object::PlainLink(obj) => obj.source,
|
||||
Object::AngleLink(obj) => obj.source,
|
||||
Object::OrgMacro(obj) => obj.source,
|
||||
Object::Entity(obj) => obj.source,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,3 +195,9 @@ impl<'s> Source<'s> for OrgMacro<'s> {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Entity<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user