pub trait InnerState: Default {
type Output: Sized;
// Required method
fn parse_inner_finish(self) -> Result<Self::Output>;
// Provided methods
fn parse_inner_node<P: ElementParser>(
&mut self,
tag: &str,
parser: P,
) -> Result<InnerParseResult<P>> { ... }
fn parse_inner_text<'t>(
&mut self,
text: Cow<'t, str>,
) -> Result<InnerParseResult<Cow<'t, str>>> { ... }
}
Expand description
State to parse multiple elements (on the same level)
Required Associated Types§
Required Methods§
Sourcefn parse_inner_finish(self) -> Result<Self::Output>
fn parse_inner_finish(self) -> Result<Self::Output>
Finish parsing.
Provided Methods§
Sourcefn parse_inner_node<P: ElementParser>(
&mut self,
tag: &str,
parser: P,
) -> Result<InnerParseResult<P>>
fn parse_inner_node<P: ElementParser>( &mut self, tag: &str, parser: P, ) -> Result<InnerParseResult<P>>
Try parsing an element with the given tag
Should not fail if it doesn’t recognize the tag; instead it needs to return the parser.
Sourcefn parse_inner_text<'t>(
&mut self,
text: Cow<'t, str>,
) -> Result<InnerParseResult<Cow<'t, str>>>
fn parse_inner_text<'t>( &mut self, text: Cow<'t, str>, ) -> Result<InnerParseResult<Cow<'t, str>>>
Try parsing inner text
Should not fail if it doesn’t take text (but may fail if it does but can’t parse it).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl InnerState for Cow<'_, str>
impl InnerState for Cow<'_, str>
Source§impl InnerState for String
Using String
as InnerState
to collect all inner text in it (including whitespace in input)
impl InnerState for String
Using String
as InnerState
to collect all inner text in it (including whitespace in input)