Make element function public

This commit is contained in:
Timothy Warren 2019-04-23 09:48:42 -04:00
parent 97433c2e7f
commit a965955807

View File

@ -1,17 +1,17 @@
#[derive(Clone, Debug, PartialEq, Eq)]
struct Element {
pub struct Element {
name: String,
attributes: Vec<(String, String)>,
children: Vec<Element>,
}
struct BoxedParser<'a, Output> {
pub struct BoxedParser<'a, Output> {
parser: Box<dyn Parser<'a, Output> + 'a>,
}
type ParseResult<'a, Output> = Result<(&'a str, Output), &'a str>;
pub type ParseResult<'a, Output> = Result<(&'a str, Output), &'a str>;
trait Parser<'a, Output> {
pub trait Parser<'a, Output> {
fn parse(&self, input: &'a str) -> ParseResult<'a, Output>;
fn map<F, NewOutput>(self, map_fn: F) -> BoxedParser<'a, NewOutput>
@ -264,7 +264,7 @@ where
}
}
fn element<'a>() -> impl Parser<'a, Element> {
pub fn element<'a>() -> impl Parser<'a, Element> {
whitespace_wrap(either(single_element(), parent_element()))
}