pub trait Visitor<B: AsyncBufRead + Unpin> {
type Output;
fn build(self) -> Result<Self::Output, Error>;
fn start_name() -> Option<&'static str> { ... }
fn visit_tag(&mut self, name: &str) -> Result<(), Error> { ... }
fn visit_attribute(&mut self, name: &str, value: &str) -> Result<(), Error> { ... }
fn visit_child<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
reader: &'life2 mut PeekingReader<B>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
fn visit_text(&mut self, text: &str) -> Result<(), Error> { ... }
}
Expand description
A trait for building up instances of types during deserialization
As XmlReader::read_event_into_async()
does not return a Send
future, this entire trait must be ?Send
.
Required Associated Types
Required Methods
Provided Methods
sourcefn start_name() -> Option<&'static str>
fn start_name() -> Option<&'static str>
Should return the expected starting tag name, if any
Visit the starting tag with the given name
This is called exactly once during deserialization and will be called before any other visit_*
methods.
Visit an attribute with the given name and value
sourcefn visit_child<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
reader: &'life2 mut PeekingReader<B>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn visit_child<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
reader: &'life2 mut PeekingReader<B>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Visit a child element with the given tag name
Implementations must make sure the child element is read in some way. Most likely this will be either a
reader.skip_element()
or reader.deserialize()
call.