Derive partial eq for all objects so we can match radio links.

This commit is contained in:
Tom Alexander 2023-04-24 19:25:22 -04:00
parent fec7d51f75
commit 6ed33d3522
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,6 +1,6 @@
use super::source::Source; use super::source::Source;
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub enum Object<'s> { pub enum Object<'s> {
RegularLink(RegularLink<'s>), RegularLink(RegularLink<'s>),
RadioLink(RadioLink<'s>), RadioLink(RadioLink<'s>),
@ -14,59 +14,59 @@ pub enum Object<'s> {
PlainText(PlainText<'s>), PlainText(PlainText<'s>),
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct Bold<'s> { pub struct Bold<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct Italic<'s> { pub struct Italic<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct Underline<'s> { pub struct Underline<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct StrikeThrough<'s> { pub struct StrikeThrough<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct Code<'s> { pub struct Code<'s> {
pub source: &'s str, pub source: &'s str,
pub contents: &'s str, pub contents: &'s str,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct Verbatim<'s> { pub struct Verbatim<'s> {
pub source: &'s str, pub source: &'s str,
pub contents: &'s str, pub contents: &'s str,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct PlainText<'s> { pub struct PlainText<'s> {
pub source: &'s str, pub source: &'s str,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct RegularLink<'s> { pub struct RegularLink<'s> {
pub source: &'s str, pub source: &'s str,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct RadioTarget<'s> { pub struct RadioTarget<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct RadioLink<'s> { pub struct RadioLink<'s> {
pub source: &'s str, pub source: &'s str,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,