Define regular link.

This commit is contained in:
Tom Alexander 2023-03-23 17:02:08 -04:00
parent fd45e4381c
commit 66befc66a9
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 8 additions and 2 deletions

View File

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