Put back in needed pubs.

This commit is contained in:
Tom Alexander
2023-09-11 13:13:28 -04:00
parent 7650a9edff
commit 84953c1669
71 changed files with 522 additions and 515 deletions

View File

@@ -14,7 +14,7 @@ use crate::error::Res;
use crate::parser::OrgSource;
#[derive(Debug)]
enum ContextElement<'r, 's> {
pub(crate) enum ContextElement<'r, 's> {
/// Stores a parser that indicates that children should exit upon matching an exit matcher.
ExitMatcherNode(ExitMatcherNode<'r>),
@@ -31,10 +31,10 @@ use crate::parser::OrgSource;
Placeholder(PhantomData<&'s str>),
}
struct ExitMatcherNode<'r> {
pub(crate) struct ExitMatcherNode<'r> {
// TODO: Should this be "&'r DynContextMatcher<'c>" ?
exit_matcher: &'r DynContextMatcher<'r>,
class: ExitClass,
pub(crate) exit_matcher: &'r DynContextMatcher<'r>,
pub(crate) class: ExitClass,
}
impl<'r> std::fmt::Debug for ExitMatcherNode<'r> {
@@ -46,13 +46,13 @@ impl<'r> std::fmt::Debug for ExitMatcherNode<'r> {
}
#[derive(Debug)]
struct Context<'g, 'r, 's> {
pub(crate) struct Context<'g, 'r, 's> {
global_settings: &'g GlobalSettings<'g, 's>,
tree: List<'r, &'r ContextElement<'r, 's>>,
}
impl<'g, 'r, 's> Context<'g, 'r, 's> {
fn new(
pub(crate) fn new(
global_settings: &'g GlobalSettings<'g, 's>,
tree: List<'r, &'r ContextElement<'r, 's>>,
) -> Self {
@@ -62,38 +62,38 @@ impl<'g, 'r, 's> Context<'g, 'r, 's> {
}
}
fn with_additional_node(&'r self, new_element: &'r ContextElement<'r, 's>) -> Self {
pub(crate) fn with_additional_node(&'r self, new_element: &'r ContextElement<'r, 's>) -> Self {
let new_tree = self.tree.push(new_element);
Self::new(self.global_settings, new_tree)
}
fn iter(&'r self) -> super::list::Iter<'r, &'r ContextElement<'r, 's>> {
pub(crate) fn iter(&'r self) -> super::list::Iter<'r, &'r ContextElement<'r, 's>> {
self.tree.iter()
}
fn iter_context(&'r self) -> Iter<'g, 'r, 's> {
fn iter_context(&'r self) -> Iter<'g, 'r, 's> {
Iter {
next: self.tree.iter_list(),
global_settings: self.global_settings,
}
}
fn get_parent(&'r self) -> Option<Self> {
pub(crate) fn get_parent(&'r self) -> Option<Self> {
self.tree.get_parent().map(|parent_tree| Self {
global_settings: self.global_settings,
tree: parent_tree.clone(),
})
}
fn get_data(&self) -> &ContextElement<'r, 's> {
fn get_data(&self) -> &ContextElement<'r, 's> {
self.tree.get_data()
}
fn get_global_settings(&self) -> &'g GlobalSettings<'g, 's> {
pub(crate) fn get_global_settings(&self) -> &'g GlobalSettings<'g, 's> {
self.global_settings
}
fn with_global_settings<'gg>(
pub(crate) fn with_global_settings<'gg>(
&self,
new_settings: &'gg GlobalSettings<'gg, 's>,
) -> Context<'gg, 'r, 's> {
@@ -104,7 +104,7 @@ impl<'g, 'r, 's> Context<'g, 'r, 's> {
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn check_exit_matcher(
pub(crate) fn check_exit_matcher(
&'r self,
i: OrgSource<'s>,
) -> IResult<OrgSource<'s>, OrgSource<'s>, CustomError<OrgSource<'s>>> {
@@ -133,7 +133,7 @@ impl<'g, 'r, 's> Context<'g, 'r, 's> {
/// Indicates if elements should consume the whitespace after them.
///
/// Defaults to true.
fn should_consume_trailing_whitespace(&self) -> bool {
pub(crate) fn should_consume_trailing_whitespace(&self) -> bool {
self._should_consume_trailing_whitespace().unwrap_or(true)
}
@@ -158,7 +158,7 @@ fn document_end<'b, 'g, 'r, 's>(
eof(input)
}
struct Iter<'g, 'r, 's> {
struct Iter<'g, 'r, 's> {
global_settings: &'g GlobalSettings<'g, 's>,
next: super::list::IterList<'r, &'r ContextElement<'r, 's>>,
}
@@ -175,7 +175,7 @@ impl<'g, 'r, 's> Iterator for Iter<'g, 'r, 's> {
}
impl<'r, 's> ContextElement<'r, 's> {
fn document_context() -> Self {
pub(crate) fn document_context() -> Self {
Self::ExitMatcherNode(ExitMatcherNode {
exit_matcher: &document_end,
class: ExitClass::Document,