Remove PartialEq from Object.
This commit is contained in:
parent
10aa0956ee
commit
f5699ce830
@ -128,7 +128,7 @@ pub struct DiffResult<'b, 's> {
|
|||||||
emacs_token: &'b Token<'s>,
|
emacs_token: &'b Token<'s>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub(crate) enum DiffStatus {
|
pub(crate) enum DiffStatus {
|
||||||
Good,
|
Good,
|
||||||
Bad,
|
Bad,
|
||||||
@ -164,7 +164,7 @@ impl<'b, 's> DiffEntry<'b, 's> {
|
|||||||
|
|
||||||
fn is_immediately_bad(&self) -> bool {
|
fn is_immediately_bad(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
DiffEntry::DiffResult(diff) => diff.status == DiffStatus::Bad,
|
DiffEntry::DiffResult(diff) => matches!(diff.status, DiffStatus::Bad),
|
||||||
DiffEntry::DiffLayer(_) => false,
|
DiffEntry::DiffLayer(_) => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ fn impl_balanced_bracket<
|
|||||||
let contents_end = remaining;
|
let contents_end = remaining;
|
||||||
|
|
||||||
let (remaining, _) = end_parser(remaining)?;
|
let (remaining, _) = end_parser(remaining)?;
|
||||||
let contents = if contents_start != contents_end {
|
let contents = if Into::<&str>::into(contents_start) != Into::<&str>::into(contents_end) {
|
||||||
Some(contents_start.get_until(contents_end))
|
Some(contents_start.get_until(contents_end))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -244,7 +244,7 @@ mod tests {
|
|||||||
let input = OrgSource::new("()");
|
let input = OrgSource::new("()");
|
||||||
let (remaining, call) = opt(babel_call_call)(input)?;
|
let (remaining, call) = opt(babel_call_call)(input)?;
|
||||||
assert_eq!(Into::<&str>::into(remaining), "()");
|
assert_eq!(Into::<&str>::into(remaining), "()");
|
||||||
assert_eq!(call, None);
|
assert!(matches!(call, None));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,12 +210,12 @@ mod tests {
|
|||||||
use crate::context::GlobalSettings;
|
use crate::context::GlobalSettings;
|
||||||
use crate::context::List;
|
use crate::context::List;
|
||||||
use crate::parser::element_parser::element;
|
use crate::parser::element_parser::element;
|
||||||
use crate::types::CitationReference;
|
|
||||||
use crate::types::Element;
|
use crate::types::Element;
|
||||||
use crate::types::GetStandardProperties;
|
use crate::types::GetStandardProperties;
|
||||||
|
use crate::types::StandardProperties;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn citation_simple() {
|
fn citation_simple() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let input = OrgSource::new("[cite:@foo]");
|
let input = OrgSource::new("[cite:@foo]");
|
||||||
let global_settings = GlobalSettings::default();
|
let global_settings = GlobalSettings::default();
|
||||||
let initial_context = ContextElement::document_context();
|
let initial_context = ContextElement::document_context();
|
||||||
@ -232,23 +232,31 @@ mod tests {
|
|||||||
"[cite:@foo]"
|
"[cite:@foo]"
|
||||||
);
|
);
|
||||||
assert_eq!(first_paragraph.children.len(), 1);
|
assert_eq!(first_paragraph.children.len(), 1);
|
||||||
assert_eq!(
|
|
||||||
first_paragraph
|
match first_paragraph
|
||||||
.children
|
.children
|
||||||
.first()
|
.first()
|
||||||
.expect("Len already asserted to be 1"),
|
.expect("Len already asserted to be 1.")
|
||||||
&Object::Citation(Citation {
|
{
|
||||||
source: "[cite:@foo]",
|
Object::Citation(inner) => {
|
||||||
style: None,
|
assert_eq!(inner.get_source(), "[cite:@foo]");
|
||||||
prefix: vec![],
|
assert_eq!(inner.children.len(), 1);
|
||||||
suffix: vec![],
|
assert!(inner.prefix.is_empty());
|
||||||
children: vec![CitationReference {
|
assert!(inner.suffix.is_empty());
|
||||||
source: "@foo",
|
assert!(inner.style.is_none());
|
||||||
key: "foo",
|
let citation_reference = inner
|
||||||
prefix: vec![],
|
.children
|
||||||
suffix: vec![]
|
.first()
|
||||||
}]
|
.expect("Len already asserted to be 1.");
|
||||||
})
|
assert_eq!(citation_reference.get_source(), "@foo");
|
||||||
);
|
assert_eq!(citation_reference.key, "foo");
|
||||||
|
assert!(citation_reference.prefix.is_empty());
|
||||||
|
assert!(citation_reference.suffix.is_empty());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err("Child should be a citation.".into());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use nom::Slice;
|
|||||||
|
|
||||||
pub(crate) type BracketDepth = i16;
|
pub(crate) type BracketDepth = i16;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone)]
|
||||||
pub(crate) struct OrgSource<'s> {
|
pub(crate) struct OrgSource<'s> {
|
||||||
full_source: &'s str,
|
full_source: &'s str,
|
||||||
start: usize,
|
start: usize,
|
||||||
|
@ -179,7 +179,7 @@ mod tests {
|
|||||||
use crate::types::PlainText;
|
use crate::types::PlainText;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn plain_text_radio_target() {
|
fn plain_text_radio_target() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let input = OrgSource::new("foo bar baz");
|
let input = OrgSource::new("foo bar baz");
|
||||||
let radio_target_match = vec![Object::PlainText(PlainText { source: "bar" })];
|
let radio_target_match = vec![Object::PlainText(PlainText { source: "bar" })];
|
||||||
let global_settings = GlobalSettings {
|
let global_settings = GlobalSettings {
|
||||||
@ -200,21 +200,31 @@ mod tests {
|
|||||||
"foo bar baz"
|
"foo bar baz"
|
||||||
);
|
);
|
||||||
assert_eq!(first_paragraph.children.len(), 3);
|
assert_eq!(first_paragraph.children.len(), 3);
|
||||||
assert_eq!(
|
match first_paragraph
|
||||||
first_paragraph
|
.children
|
||||||
.children
|
.get(1)
|
||||||
.get(1)
|
.expect("Len already asserted to be 3.")
|
||||||
.expect("Len already asserted to be 3"),
|
{
|
||||||
&Object::RadioLink(RadioLink {
|
Object::RadioLink(inner) => {
|
||||||
source: "bar ",
|
assert_eq!(inner.get_standard_properties().get_source(), "bar ");
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
assert_eq!(inner.path, "bar");
|
||||||
path: "bar"
|
assert_eq!(inner.children.len(), 1);
|
||||||
})
|
let child = inner
|
||||||
);
|
.children
|
||||||
|
.get(0)
|
||||||
|
.expect("Length already asserted to be 1.");
|
||||||
|
assert!(matches!(child, Object::PlainText(_)));
|
||||||
|
assert_eq!(child.get_standard_properties().get_source(), "bar");
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err("Child should be a radio link.".into());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bold_radio_target() {
|
fn bold_radio_target() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let input = OrgSource::new("foo *bar* baz");
|
let input = OrgSource::new("foo *bar* baz");
|
||||||
let radio_target_match = vec![Object::Bold(Bold {
|
let radio_target_match = vec![Object::Bold(Bold {
|
||||||
source: "*bar*",
|
source: "*bar*",
|
||||||
@ -239,19 +249,41 @@ mod tests {
|
|||||||
"foo *bar* baz"
|
"foo *bar* baz"
|
||||||
);
|
);
|
||||||
assert_eq!(first_paragraph.children.len(), 3);
|
assert_eq!(first_paragraph.children.len(), 3);
|
||||||
assert_eq!(
|
match first_paragraph
|
||||||
first_paragraph
|
.children
|
||||||
.children
|
.get(1)
|
||||||
.get(1)
|
.expect("Len already asserted to be 3.")
|
||||||
.expect("Len already asserted to be 3"),
|
{
|
||||||
&Object::RadioLink(RadioLink {
|
Object::RadioLink(inner) => {
|
||||||
source: "*bar* ",
|
assert_eq!(inner.get_standard_properties().get_source(), "*bar* ");
|
||||||
children: vec![Object::Bold(Bold {
|
assert_eq!(inner.path, "*bar* ");
|
||||||
source: "*bar* ",
|
assert_eq!(inner.children.len(), 1);
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })]
|
let child = inner
|
||||||
})],
|
.children
|
||||||
path: "*bar* "
|
.get(0)
|
||||||
})
|
.expect("Length already asserted to be 1.");
|
||||||
);
|
assert!(matches!(child, Object::Bold(_)));
|
||||||
|
assert_eq!(child.get_standard_properties().get_source(), "*bar* ");
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err("Child should be a radio link.".into());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
|
|
||||||
|
// assert_eq!(
|
||||||
|
// first_paragraph
|
||||||
|
// .children
|
||||||
|
// .get(1)
|
||||||
|
// .expect("Len already asserted to be 3"),
|
||||||
|
// &Object::RadioLink(RadioLink {
|
||||||
|
// source: "*bar* ",
|
||||||
|
// children: vec![Object::Bold(Bold {
|
||||||
|
// source: "*bar* ",
|
||||||
|
// children: vec![Object::PlainText(PlainText { source: "bar" })]
|
||||||
|
// })],
|
||||||
|
// path: "*bar* "
|
||||||
|
// })
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,7 @@ use super::util::to_lowercase;
|
|||||||
use super::GetStandardProperties;
|
use super::GetStandardProperties;
|
||||||
use super::StandardProperties;
|
use super::StandardProperties;
|
||||||
|
|
||||||
// TODO: Why did we make Object implement PartialEq again? Was it just for tests?
|
#[derive(Debug)]
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
pub enum Object<'s> {
|
pub enum Object<'s> {
|
||||||
Bold(Bold<'s>),
|
Bold(Bold<'s>),
|
||||||
Italic(Italic<'s>),
|
Italic(Italic<'s>),
|
||||||
@ -41,48 +40,48 @@ pub enum Object<'s> {
|
|||||||
Timestamp(Timestamp<'s>),
|
Timestamp(Timestamp<'s>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
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, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct PlainText<'s> {
|
pub struct PlainText<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct RegularLink<'s> {
|
pub struct RegularLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub link_type: LinkType<'s>,
|
pub link_type: LinkType<'s>,
|
||||||
@ -105,21 +104,21 @@ pub struct RegularLink<'s> {
|
|||||||
pub application: Option<Cow<'s, str>>,
|
pub application: Option<Cow<'s, str>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct RadioTarget<'s> {
|
pub struct RadioTarget<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
pub children: Vec<Object<'s>>,
|
pub children: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct RadioLink<'s> {
|
pub struct RadioLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub path: &'s str,
|
pub path: &'s str,
|
||||||
pub children: Vec<Object<'s>>,
|
pub children: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct PlainLink<'s> {
|
pub struct PlainLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub link_type: LinkType<'s>,
|
pub link_type: LinkType<'s>,
|
||||||
@ -129,7 +128,7 @@ pub struct PlainLink<'s> {
|
|||||||
pub application: Option<&'s str>,
|
pub application: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct AngleLink<'s> {
|
pub struct AngleLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub link_type: LinkType<'s>,
|
pub link_type: LinkType<'s>,
|
||||||
@ -147,7 +146,7 @@ pub struct AngleLink<'s> {
|
|||||||
pub application: Option<&'s str>,
|
pub application: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct OrgMacro<'s> {
|
pub struct OrgMacro<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
|
|
||||||
@ -164,7 +163,7 @@ pub struct OrgMacro<'s> {
|
|||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Entity<'s> {
|
pub struct Entity<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub name: &'s str,
|
pub name: &'s str,
|
||||||
@ -177,27 +176,27 @@ pub struct Entity<'s> {
|
|||||||
pub use_brackets: bool,
|
pub use_brackets: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct LatexFragment<'s> {
|
pub struct LatexFragment<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct ExportSnippet<'s> {
|
pub struct ExportSnippet<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub backend: &'s str,
|
pub backend: &'s str,
|
||||||
pub contents: Option<&'s str>,
|
pub contents: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct FootnoteReference<'s> {
|
pub struct FootnoteReference<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub label: Option<&'s str>,
|
pub label: Option<&'s str>,
|
||||||
pub definition: Vec<Object<'s>>,
|
pub definition: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Citation<'s> {
|
pub struct Citation<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub style: Option<&'s str>,
|
pub style: Option<&'s str>,
|
||||||
@ -206,7 +205,7 @@ pub struct Citation<'s> {
|
|||||||
pub children: Vec<CitationReference<'s>>,
|
pub children: Vec<CitationReference<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct CitationReference<'s> {
|
pub struct CitationReference<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub key: &'s str,
|
pub key: &'s str,
|
||||||
@ -214,7 +213,7 @@ pub struct CitationReference<'s> {
|
|||||||
pub suffix: Vec<Object<'s>>,
|
pub suffix: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct InlineBabelCall<'s> {
|
pub struct InlineBabelCall<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
@ -224,7 +223,7 @@ pub struct InlineBabelCall<'s> {
|
|||||||
pub end_header: Option<&'s str>,
|
pub end_header: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct InlineSourceBlock<'s> {
|
pub struct InlineSourceBlock<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub language: &'s str,
|
pub language: &'s str,
|
||||||
@ -232,31 +231,31 @@ pub struct InlineSourceBlock<'s> {
|
|||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct LineBreak<'s> {
|
pub struct LineBreak<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Target<'s> {
|
pub struct Target<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct StatisticsCookie<'s> {
|
pub struct StatisticsCookie<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub value: &'s str,
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Subscript<'s> {
|
pub struct Subscript<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub use_brackets: bool,
|
pub use_brackets: bool,
|
||||||
pub children: Vec<Object<'s>>,
|
pub children: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Superscript<'s> {
|
pub struct Superscript<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub use_brackets: bool,
|
pub use_brackets: bool,
|
||||||
@ -264,7 +263,7 @@ pub struct Superscript<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Perhaps there is an optimization of converting to unix time we can do to shrink this struct. (ref: clippy::large_enum_variant on Element)
|
// TODO: Perhaps there is an optimization of converting to unix time we can do to shrink this struct. (ref: clippy::large_enum_variant on Element)
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Timestamp<'s> {
|
pub struct Timestamp<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub timestamp_type: TimestampType,
|
pub timestamp_type: TimestampType,
|
||||||
@ -277,7 +276,7 @@ pub struct Timestamp<'s> {
|
|||||||
pub warning_delay: Option<WarningDelay>,
|
pub warning_delay: Option<WarningDelay>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum TimestampType {
|
pub enum TimestampType {
|
||||||
Diary,
|
Diary,
|
||||||
Active,
|
Active,
|
||||||
@ -286,7 +285,7 @@ pub enum TimestampType {
|
|||||||
InactiveRange,
|
InactiveRange,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum TimestampRangeType {
|
pub enum TimestampRangeType {
|
||||||
None,
|
None,
|
||||||
DateRange,
|
DateRange,
|
||||||
@ -299,19 +298,19 @@ pub type DayOfMonthInner = u8;
|
|||||||
pub type HourInner = u8;
|
pub type HourInner = u8;
|
||||||
pub type MinuteInner = u8;
|
pub type MinuteInner = u8;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Year(YearInner);
|
pub struct Year(YearInner);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Month(MonthInner);
|
pub struct Month(MonthInner);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DayOfMonth(DayOfMonthInner);
|
pub struct DayOfMonth(DayOfMonthInner);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Hour(HourInner);
|
pub struct Hour(HourInner);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Minute(MinuteInner);
|
pub struct Minute(MinuteInner);
|
||||||
|
|
||||||
impl Year {
|
impl Year {
|
||||||
@ -386,7 +385,7 @@ impl Minute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Date<'s> {
|
pub struct Date<'s> {
|
||||||
year: Year,
|
year: Year,
|
||||||
month: Month,
|
month: Month,
|
||||||
@ -444,7 +443,7 @@ impl<'s> Date<'s> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Time<'s> {
|
pub struct Time<'s> {
|
||||||
hour: Hour,
|
hour: Hour,
|
||||||
minute: Minute,
|
minute: Minute,
|
||||||
@ -478,20 +477,20 @@ impl<'s> Time<'s> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum RepeaterType {
|
pub enum RepeaterType {
|
||||||
Cumulative,
|
Cumulative,
|
||||||
CatchUp,
|
CatchUp,
|
||||||
Restart,
|
Restart,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum WarningDelayType {
|
pub enum WarningDelayType {
|
||||||
All,
|
All,
|
||||||
First,
|
First,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum TimeUnit {
|
pub enum TimeUnit {
|
||||||
Hour,
|
Hour,
|
||||||
Day,
|
Day,
|
||||||
@ -502,14 +501,14 @@ pub enum TimeUnit {
|
|||||||
|
|
||||||
pub type RepeaterWarningDelayValueType = u16;
|
pub type RepeaterWarningDelayValueType = u16;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Repeater {
|
pub struct Repeater {
|
||||||
pub repeater_type: RepeaterType,
|
pub repeater_type: RepeaterType,
|
||||||
pub value: RepeaterWarningDelayValueType,
|
pub value: RepeaterWarningDelayValueType,
|
||||||
pub unit: TimeUnit,
|
pub unit: TimeUnit,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct WarningDelay {
|
pub struct WarningDelay {
|
||||||
pub warning_delay_type: WarningDelayType,
|
pub warning_delay_type: WarningDelayType,
|
||||||
pub value: RepeaterWarningDelayValueType,
|
pub value: RepeaterWarningDelayValueType,
|
||||||
@ -718,7 +717,7 @@ impl<'s> Timestamp<'s> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub enum LinkType<'s> {
|
pub enum LinkType<'s> {
|
||||||
File,
|
File,
|
||||||
Protocol(Cow<'s, str>),
|
Protocol(Cow<'s, str>),
|
||||||
@ -787,7 +786,7 @@ impl<'s> OrgMacro<'s> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub enum FootnoteReferenceType {
|
pub enum FootnoteReferenceType {
|
||||||
Standard,
|
Standard,
|
||||||
Inline,
|
Inline,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user