Lifetime issue.

This commit is contained in:
Tom Alexander 2023-09-03 12:58:46 -04:00
parent d262833f9b
commit a7b9eb9db4
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -48,19 +48,21 @@ use crate::types::Section;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
#[allow(dead_code)]
pub fn parse(input: &str) -> Res<&str, Document> {
pub fn parse<'s>(input: &'s str) -> Result<Document<'s>, String> {
let global_settings = GlobalSettings::default();
let initial_context = ContextElement::document_context();
let initial_context = Context::new(&global_settings, List::new(&initial_context));
let wrapped_input = OrgSource::new(input);
let _foo = document(&initial_context, wrapped_input);
todo!()
let ret = document(&initial_context, wrapped_input)
.map_err(|err| err.to_string())
.map(|(remaining, parsed_document)| parsed_document);
ret
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
#[allow(dead_code)]
pub fn document<'r, 's>(
context: RefContext<'_, 'r, 's>,
pub fn document<'b, 'r, 's>(
context: RefContext<'b, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Document<'s>> {
let (remaining, document) =