pub struct AbxParser<'a> { /* private fields */ }Expand description
Zero-allocation pull parser that works on an in-memory &[u8].
Advance through the document with next_event or
use one of the higher-level helpers.
Implementations§
Source§impl<'a> AbxParser<'a>
impl<'a> AbxParser<'a>
Sourcepub fn new(input: &'a [u8]) -> Result<Self>
pub fn new(input: &'a [u8]) -> Result<Self>
Create a parser, validating the 4-byte magic header.
Sourcepub fn next_event(&mut self) -> Result<Option<Event>>
pub fn next_event(&mut self) -> Result<Option<Event>>
Pull the next Event. Returns None at end of input.
Sourcepub fn collect_events(&mut self) -> Result<Vec<Event>>
pub fn collect_events(&mut self) -> Result<Vec<Event>>
Drain all remaining events into a Vec.
Sourcepub fn find_attribute(
&mut self,
element: &str,
attr: &str,
) -> Option<AttributeValue>
pub fn find_attribute( &mut self, element: &str, attr: &str, ) -> Option<AttributeValue>
Return the value of the first matching attr_name inside any
<element_name> in the remaining stream.
Sourcepub fn find_all_attributes(
&mut self,
element: &str,
attr: &str,
) -> Result<Vec<AttributeValue>>
pub fn find_all_attributes( &mut self, element: &str, attr: &str, ) -> Result<Vec<AttributeValue>>
All values of attr_name found in <element_name> tags.
Sourcepub fn attributes_of(&mut self, element: &str) -> Option<Vec<Attribute>>
pub fn attributes_of(&mut self, element: &str) -> Option<Vec<Attribute>>
Attributes of the first <element_name> tag.
Sourcepub fn all_attributes_of(
&mut self,
element: &str,
) -> Result<Vec<Vec<Attribute>>>
pub fn all_attributes_of( &mut self, element: &str, ) -> Result<Vec<Vec<Attribute>>>
Attributes of every <element_name> tag.
Sourcepub fn deserialize_next<T: DeserializeOwned>(
&mut self,
element: &str,
) -> Result<Option<T>>
pub fn deserialize_next<T: DeserializeOwned>( &mut self, element: &str, ) -> Result<Option<T>>
Find the next <element>, deserialize its attributes (and direct
text content, via a #[serde(rename = "$text")] field) into T,
then skip past its matching end tag. Ok(None) at end of document.
Sourcepub fn deserialize_all<T: DeserializeOwned>(
&mut self,
element: &str,
) -> Result<Vec<T>>
pub fn deserialize_all<T: DeserializeOwned>( &mut self, element: &str, ) -> Result<Vec<T>>
Deserialize every remaining <element> into a Vec<T>.