From 93f1bcd7445876b151acb1fd1e31c36adab208c6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Sep 2023 20:47:18 -0400 Subject: [PATCH] Add getters for Document. --- src/types/document.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/types/document.rs b/src/types/document.rs index c8001e5..974d77b 100644 --- a/src/types/document.rs +++ b/src/types/document.rs @@ -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>, - pub children: Vec>, + pub(crate) source: &'s str, + pub(crate) zeroth_section: Option>, + pub(crate) children: Vec>, } #[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>); + ref_getter!(get_children, children, Vec>); +}