Add getters for Document.

This commit is contained in:
Tom Alexander 2023-09-29 20:47:18 -04:00
parent 47674a6907
commit 93f1bcd744
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,3 +1,4 @@
use super::macros::ref_getter;
use super::Element;
use super::GetStandardProperties;
use super::Object;
@ -8,9 +9,9 @@ pub type HeadlineLevel = u16;
#[derive(Debug)]
pub struct Document<'s> {
pub source: &'s str,
pub zeroth_section: Option<Section<'s>>,
pub children: Vec<Heading<'s>>,
pub(crate) source: &'s str,
pub(crate) zeroth_section: Option<Section<'s>>,
pub(crate) children: Vec<Heading<'s>>,
}
#[derive(Debug)]
@ -70,3 +71,8 @@ impl<'s> StandardProperties<'s> for Heading<'s> {
self.source
}
}
impl<'s> Document<'s> {
ref_getter!(get_zeroth_section, zeroth_section, Option<Section<'s>>);
ref_getter!(get_children, children, Vec<Heading<'s>>);
}