quick_xml/lib.rs
1//! High performance XML reader/writer.
2//!
3//! # Description
4//!
5//! quick-xml contains two modes of operation:
6//!
7//! A streaming API based on the [StAX] model. This is suited for larger XML documents which
8//! cannot completely read into memory at once.
9//!
10//! The user has to explicitly _ask_ for the next XML event, similar to a database cursor.
11//! This is achieved by the following two structs:
12//!
13//! - [`Reader`]: A low level XML pull-reader where buffer allocation/clearing is left to user.
14//! - [`Writer`]: A XML writer. Can be nested with readers if you want to transform XMLs.
15//!
16//! Especially for nested XML elements, the user must keep track _where_ (how deep)
17//! in the XML document the current event is located.
18//!
19//! quick-xml contains optional support of asynchronous reading and writing using [tokio].
20//! To get it enable the [`async-tokio`](#async-tokio) feature.
21//!
22//! Furthermore, quick-xml also contains optional [Serde] support to directly
23//! serialize and deserialize from structs, without having to deal with the XML events.
24//! To get it enable the [`serialize`](#serialize) feature. Read more about mapping Rust types
25//! to XML in the documentation of [`de`] module. Also check [`serde_helpers`]
26//! module.
27//!
28//! # Examples
29//!
30//! - For a reading example see [`Reader`]
31//! - For a writing example see [`Writer`]
32//!
33//! # Features
34//!
35//! `quick-xml` supports the following features:
36//!
37//! [StAX]: https://en.wikipedia.org/wiki/StAX
38//! [tokio]: https://tokio.rs/
39//! [Serde]: https://serde.rs/
40//! [`de`]: ./de/index.html
41#![cfg_attr(
42 feature = "document-features",
43 cfg_attr(doc, doc = ::document_features::document_features!(
44 feature_label = "<a id=\"{feature}\" href=\"#{feature}\"><strong><code>{feature}</code></strong></a>"
45 ))
46)]
47#![forbid(unsafe_code)]
48#![deny(missing_docs)]
49#![recursion_limit = "1024"]
50// Enable feature requirements in the docs from 1.57
51// See https://stackoverflow.com/questions/61417452
52// docs.rs defines `docsrs` when building documentation
53#![cfg_attr(docsrs, feature(doc_auto_cfg))]
54
55#[cfg(feature = "serialize")]
56pub mod de;
57pub mod encoding;
58pub mod errors;
59pub mod escape;
60pub mod events;
61pub mod name;
62pub mod parser;
63pub mod reader;
64#[cfg(feature = "serialize")]
65pub mod se;
66#[cfg(feature = "serde-types")]
67pub mod serde_helpers;
68/// Not an official API, public for integration tests
69#[doc(hidden)]
70pub mod utils;
71pub mod writer;
72
73// reexports
74pub use crate::encoding::Decoder;
75#[cfg(feature = "serialize")]
76pub use crate::errors::serialize::{DeError, SeError};
77pub use crate::errors::{Error, Result};
78pub use crate::reader::{NsReader, Reader};
79pub use crate::writer::{ElementWriter, Writer};