How quick-xml works: Reader, Writer, and Serde
masterThe quick-xml library provides three primary ways to interact with XML:
- Reader (Pull Parsing): A low-level, high-performance streaming API. It uses an event-based model where you pull
Events (likeStart,End,Text,Eof) from a buffer. It is designed to be zero-copy and memory-efficient by allowing buffer reuse. - Writer: A streaming API for constructing XML. It works by writing
Events to an underlyingstd::io::Writesink. It is often used in conjunction with aReaderto transform XML on the fly. - Serde Integration: A high-level abstraction that maps XML structures to Rust data types. This is built on top of the core parsing logic and is ideal when you want to work with strongly-typed data rather than raw events.