Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.56.0
- uses: dtolnay/rust-toolchain@1.79.0
- run: cargo check

minimal-versions:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/tafia/quick-xml"
keywords = ["xml", "serde", "parser", "writer", "html"]
categories = ["asynchronous", "encoding", "parsing", "parser-implementations"]
license = "MIT"
rust-version = "1.56"
rust-version = "1.79"
# We exclude tests & examples & benches to reduce the size of a package.
# Unfortunately, this is source of warnings in latest cargo when packaging:
# > warning: ignoring {context} `{name}` as `{path}` is not included in the published package
Expand Down Expand Up @@ -62,6 +62,11 @@ name = "macrobenches"
harness = false
path = "benches/macrobenches.rs"

[[bench]]
name = "encoding"
harness = false
path = "benches/encoding.rs"

[features]
default = []

Expand Down Expand Up @@ -213,11 +218,6 @@ name = "async-tokio"
required-features = ["async-tokio"]
path = "tests/async-tokio.rs"

[[test]]
name = "encodings"
required-features = ["encoding"]
path = "tests/encodings.rs"

[[test]]
name = "html"
required-features = ["escape-html"]
Expand Down
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
- `Attribute::decode_and_unescape_value_with()`

Deprecated functions now behaves the same as newly added.
-[#947]: Add new constructors to `Reader` and `NsReader` that perform automatic streaming UTF-8
validation on the underlying input. Validation failures are raised as errors when the `Reader`
is used. These APIs are currently considered "experimental".
- `Reader::from_reader_validating()`
- `Reader::from_file_validating()`
- `NsReader::from_reader_validating()`
- `NsReader::from_file_validating()`

### Bug Fixes

Expand All @@ -46,11 +53,13 @@
accepts `XmlVersion` parameter to apply correct EOL normalization rules.
- [#944]: `read_text()` now returns `BytesText` which allows you to get the content with
properly normalized EOLs. To get the previous behavior use `.read_text().decode()?`.
- [#947]: Bumped MSRV from 1.59 (Feb 2022) to 1.79 (June 2024)

[#371]: https://github.com/tafia/quick-xml/issues/371
[#914]: https://github.com/tafia/quick-xml/pull/914
[#938]: https://github.com/tafia/quick-xml/pull/938
[#944]: https://github.com/tafia/quick-xml/pull/944
[#947]: https://github.com/tafia/quick-xml/pull/947


## 0.39.2 -- 2026-02-20
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Crate](https://img.shields.io/crates/v/quick-xml.svg)](https://crates.io/crates/quick-xml)
[![docs.rs](https://docs.rs/quick-xml/badge.svg)](https://docs.rs/quick-xml)
[![codecov](https://img.shields.io/codecov/c/github/tafia/quick-xml)](https://codecov.io/gh/tafia/quick-xml)
[![MSRV](https://img.shields.io/badge/rustc-1.56.0+-ab6000.svg)](https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html)
[![MSRV](https://img.shields.io/badge/rustc-1.79.0+-ab6000.svg)](https://blog.rust-lang.org/2024/06/13/Rust-1.79.0/)

High performance xml pull reader/writer.

Expand Down
57 changes: 57 additions & 0 deletions benches/encoding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use quick_xml::encoding::Utf8ValidatingReader;
use std::io::{BufReader, Read};

static SAMPLE: &[u8] = include_bytes!("../tests/documents/sample_rss.xml");

/// Read the entire input through the reader using a fixed-size buffer,
/// returning the total number of bytes read.
fn drain_reader(reader: &mut impl Read, buf: &mut [u8]) -> usize {
let mut total = 0;
loop {
match reader.read(buf) {
Ok(0) => break,
Ok(n) => total += n,
Err(e) => panic!("unexpected error: {e}"),
}
}
total
}

fn bench_utf8_validation(c: &mut Criterion) {
let mut group = c.benchmark_group("utf8_read");
group.throughput(Throughput::Bytes(SAMPLE.len() as u64));

for buf_size in [64, 1024, 8192] {
group.bench_with_input(
BenchmarkId::new("BufReader_only", buf_size),
&buf_size,
|b, &buf_size| {
b.iter(|| {
let mut reader = BufReader::new(SAMPLE);
let mut buf = vec![0u8; buf_size];
let n = drain_reader(&mut reader, &mut buf);
assert_eq!(n, SAMPLE.len());
});
},
);

group.bench_with_input(
BenchmarkId::new("Utf8ValidatingReader", buf_size),
&buf_size,
|b, &buf_size| {
b.iter(|| {
let mut reader = Utf8ValidatingReader::new(BufReader::new(SAMPLE));
let mut buf = vec![0u8; buf_size];
let n = drain_reader(&mut reader, &mut buf);
assert_eq!(n, SAMPLE.len());
});
},
);
}

group.finish();
}

criterion_group!(benches, bench_utf8_validation);
criterion_main!(benches);
4 changes: 0 additions & 4 deletions benches/macrobenches.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// std::hint::black_box stable since 1.66, but our MSRV = 1.56.
// criterion::black_box is deprecated in since criterion 0.7.
// Running benchmarks assumed on current Rust version, so this should be fine
#![allow(clippy::incompatible_msrv)]
use criterion::{self, criterion_group, criterion_main, Criterion, Throughput};
use quick_xml::events::Event;
use quick_xml::reader::{NsReader, Reader};
Expand Down
4 changes: 0 additions & 4 deletions benches/microbenches.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// std::hint::black_box stable since 1.66, but our MSRV = 1.56.
// criterion::black_box is deprecated in since criterion 0.7.
// Running benchmarks assumed on current Rust version, so this should be fine
#![allow(clippy::incompatible_msrv)]
use criterion::{self, criterion_group, criterion_main, Criterion};
use pretty_assertions::assert_eq;
use quick_xml::escape::{escape, unescape};
Expand Down
Loading