Skip to main content

libxml_rs/
lib.rs

1//! libxml-rs: Custodial native-Rust reimplementation of libxml2 and libxslt
2//!
3//! This is not an XML crate. This is not an XSLT crate. This is not a wrapper.
4//! This is a forensic reconstruction of the observable behavior of the libxml2 + libxslt
5//! ecosystem across its historical lifetime, implemented in native Rust.
6//!
7//! # Architecture
8//!
9//! The crate is organized into semantic modules corresponding to real ownership boundaries:
10//!
11//! - `abi` - C ABI compatibility layer: types, structs, constants, exports, callbacks, allocator, ownership, versioning
12//! - `xml` - libxml2 implementation: parser, SAX, tree, entities, namespaces, DTD, validation, reader, writer, encoding, I/O, catalog, URI, XPath, XPointer, XInclude, RELAX NG, schemas, Schematron, C14N, HTML, regex, automata, dictionary, hash, list, debug, globals, threads, errors, memory
13//! - `xslt` - libxslt implementation: stylesheet, compiler, transform, templates, patterns, variables, parameters, keys, attributes, namespace_alias, whitespace, sorting, numbering, documents, imports, extensions, serialization, security, errors
14//! - `exslt` - EXSLT modules: common, math, sets, strings, dynamic, functions, dates
15//! - `compatibility` - Historical profiles, quirks, platform-specific behavior
16//! - `bin` - CLI tools: xmllint, xmlcatalog, xsltproc
17//!
18//! # Safety
19//!
20//! This crate uses `unsafe` only where fundamentally required for C ABI export, raw-pointer
21//! compatibility, foreign allocator interoperability, public C structure layout, callbacks,
22//! variadic compatibility, OS interfaces, and dynamic-loader interaction.
23//!
24//! Every unsafe block documents:
25//! - What must be true
26//! - Who establishes it
27//! - How long it remains true
28//! - Which oracle/parity court exercises the assumption
29//! - What would constitute violation
30
31#![deny(unconditional_recursion, unused_lifetimes, while_true)]
32#![warn(
33    missing_docs,
34    missing_debug_implementations,
35    clippy::all,
36    clippy::pedantic,
37    clippy::nursery,
38    clippy::cargo,
39    clippy::missing_const_for_fn,
40    clippy::missing_inline_in_public_items
41)]
42#![allow(
43    clippy::module_name_repetitions,
44    clippy::multiple_crate_versions,
45    clippy::too_many_lines,
46    clippy::type_complexity
47)]
48
49// Public ABI compatibility layer
50pub mod abi;
51
52// libxml2 implementation
53pub mod xml;
54
55// libxslt implementation
56pub mod xslt;
57
58// EXSLT implementation
59pub mod exslt;
60
61// Compatibility profiles and historical behavior
62pub mod compatibility;
63
64// Binary entry points are defined as [[bin]] targets in Cargo.toml.
65// They are NOT library modules — they depend on libxml_rs as a library.
66// See src/bin/xmllint.rs, src/bin/xmlcatalog.rs, src/bin/xsltproc.rs
67
68// Phase 0: ABI re-exports will be populated when types are defined.
69// The `allow(unused_imports)` is intentional — these will be used in Phase 1+.
70#[allow(unused_imports)]
71use abi::allocator::*;
72#[allow(unused_imports)]
73use abi::callbacks::*;
74#[allow(unused_imports)]
75use abi::constants::*;
76#[allow(unused_imports)]
77use abi::ownership::*;
78#[allow(unused_imports)]
79use abi::structs::*;
80#[allow(unused_imports)]
81use abi::types::*;
82#[allow(unused_imports)]
83use abi::versioning::*;
84
85// Internal modules (not part of public C ABI)
86mod internal;
87
88/// The full version string of the libxml-rs crate (from Cargo.toml).
89pub const LIBXML_RS_VERSION: &str = env!("CARGO_PKG_VERSION");
90
91/// Major version number of libxml-rs.
92pub const LIBXML_RS_VERSION_MAJOR: u32 = 0;
93
94/// Minor version number of libxml-rs.
95pub const LIBXML_RS_VERSION_MINOR: u32 = 1;
96
97/// Micro version (patch) number of libxml-rs.
98pub const LIBXML_RS_VERSION_MICRO: u32 = 0;