Starting to define objects based on org-mode's definitions.

This commit is contained in:
Tom Alexander 2023-03-23 16:49:52 -04:00
parent 36210c2d7f
commit 87c4a955af
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 26 additions and 0 deletions

View File

@ -4,6 +4,7 @@ mod document;
mod error; mod error;
mod link; mod link;
mod list; mod list;
mod object;
mod paragraph; mod paragraph;
mod parser_context; mod parser_context;
mod parser_with_context; mod parser_with_context;

25
src/parser/object.rs Normal file
View File

@ -0,0 +1,25 @@
pub enum Object<'s> {
TextMarkup(TextMarkup<'s>),
PlainText(PlainText<'s>),
}
pub struct TextMarkup<'s> {
pub source: &'s str,
}
pub struct PlainText<'s> {
pub source: &'s str,
}
pub trait Source<'s> {
fn get_source(&'s self) -> &'s str;
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
Object::TextMarkup(obj) => obj.source,
Object::PlainText(obj) => obj.source,
}
}
}