Code structure for radio links and radio targets.
This commit is contained in:
@@ -3,6 +3,8 @@ use super::source::Source;
|
||||
#[derive(Debug)]
|
||||
pub enum Object<'s> {
|
||||
RegularLink(RegularLink<'s>),
|
||||
RadioLink(RadioLink<'s>),
|
||||
RadioTarget(RadioTarget<'s>),
|
||||
Bold(Bold<'s>),
|
||||
Italic(Italic<'s>),
|
||||
Underline(Underline<'s>),
|
||||
@@ -58,6 +60,18 @@ pub struct RegularLink<'s> {
|
||||
pub source: &'s str,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RadioTarget<'s> {
|
||||
pub source: &'s str,
|
||||
pub children: Vec<Object<'s>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RadioLink<'s> {
|
||||
pub source: &'s str,
|
||||
pub children: Vec<Object<'s>>,
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Object<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
match self {
|
||||
@@ -69,6 +83,8 @@ impl<'s> Source<'s> for Object<'s> {
|
||||
Object::Verbatim(obj) => obj.source,
|
||||
Object::PlainText(obj) => obj.source,
|
||||
Object::RegularLink(obj) => obj.source,
|
||||
Object::RadioLink(obj) => obj.source,
|
||||
Object::RadioTarget(obj) => obj.source,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,3 +130,15 @@ impl<'s> Source<'s> for RegularLink<'s> {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for RadioLink<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for RadioTarget<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user