Make element function public
This commit is contained in:
parent
97433c2e7f
commit
a965955807
10
src/lib.rs
10
src/lib.rs
@ -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()))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user