Ran into issue with heading, naming this type is going to be a nightmare.

This commit is contained in:
Tom Alexander
2023-09-27 15:56:45 -04:00
parent 4359fc9266
commit ab46a9e5c6
2 changed files with 37 additions and 35 deletions

View File

@@ -9,6 +9,7 @@ use crate::types::Comment;
use crate::types::CommentBlock;
use crate::types::DiarySexp;
use crate::types::Document;
use crate::types::DocumentElement;
use crate::types::Drawer;
use crate::types::DynamicBlock;
use crate::types::Element;
@@ -111,6 +112,15 @@ pub enum AstNode<'r, 's> {
Timestamp(&'r Timestamp<'s>),
}
impl<'r, 's> From<&'r DocumentElement<'s>> for AstNode<'r, 's> {
fn from(value: &'r DocumentElement<'s>) -> Self {
match value {
DocumentElement::Heading(inner) => inner.into(),
DocumentElement::Section(inner) => inner.into(),
}
}
}
impl<'r, 's> From<&'r Element<'s>> for AstNode<'r, 's> {
fn from(value: &'r Element<'s>) -> Self {
match value {