Change public interface to return boxed dynamic error instead of String.
rustfmt Build rustfmt has succeeded Details
rust-test Build rust-test has succeeded Details
rust-build Build rust-build has succeeded Details
rust-foreign-document-test Build rust-foreign-document-test has succeeded Details

This commit is contained in:
Tom Alexander 2023-09-12 15:52:01 -04:00
parent 37e85158ea
commit e4c0e32536
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ use crate::types::Object;
/// This is the main entry point for Organic. It will parse the full contents of the input string as an org-mode document.
pub fn parse<'s>(input: &'s str) -> Result<Document<'s>, String> {
pub fn parse<'s>(input: &'s str) -> Result<Document<'s>, Box<dyn std::error::Error>> {
parse_with_settings(input, &GlobalSettings::default())
@ -41,7 +41,7 @@ pub fn parse<'s>(input: &'s str) -> Result<Document<'s>, String> {
pub fn parse_with_settings<'g, 's>(
input: &'s str,
global_settings: &'g GlobalSettings<'g, 's>,
) -> Result<Document<'s>, String> {
) -> Result<Document<'s>, Box<dyn std::error::Error>> {
let initial_context = ContextElement::document_context();
let initial_context = Context::new(global_settings, List::new(&initial_context));
let wrapped_input = OrgSource::new(input);
@ -49,7 +49,7 @@ pub fn parse_with_settings<'g, 's>(
.map_err(|err| err.to_string())
.map(|(_remaining, parsed_document)| parsed_document);
/// Parse a full org-mode document.