Skip to content

Commit c6acd77

Browse files
dginevclaude
andcommitted
io: tighten review polish — symmetric walk + poison, newest-wins test
Mirror trampoline_match's iteration order to trampoline_open (newest-first), .unwrap() the registry mutex in snapshot() to match register_input_callback, and add a fifth scenario asserting the documented "most recent registration wins" semantics with atomic counters. Comments and CHANGELOG entry compacted; behaviour unchanged for correct callers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ce474b5 commit c6acd77

2 files changed

Lines changed: 112 additions & 189 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44

55
### Added
66

7-
* New `io` module exposing a safe Rust wrapper around libxml2's
8-
`xmlRegisterInputCallbacks`: `io::register_input_callback(match_url,
9-
open)` accepts two closures (`&str -> bool` and `&str -> Option<Vec<u8>>`)
10-
and registers them as a custom URL-scheme handler. Useful for
11-
single-binary distributions that bundle XSLT stylesheets / RelaxNG
12-
schemas via `include_bytes!` and serve them through a synthetic
13-
URL scheme (e.g. `embed:///foo.xsl`), so `libxslt`'s `xsl:import`
14-
resolution can reach into the embedded byte tables without ever
15-
touching the disk. Closures run on whatever thread libxml2 invokes
16-
the callbacks from; the `Send + Sync + 'static` bound reflects that.
17-
A single unit test bundles three scenarios (happy path, opt-out
18-
via `None`, defer-to-default for unmatched URLs); the scenarios
19-
share one `#[test]` so they execute sequentially, sidestepping a
20-
thread-safety bug in libxml2's input-callback path on versions
21-
prior to 2.13.
7+
* New `io` module: `io::register_input_callback(match_url, open)` is
8+
a safe wrapper around `xmlRegisterInputCallbacks`. Accepts two
9+
closures (`&str -> bool`, `&str -> Option<Vec<u8>>`) and installs
10+
them as a custom URL-scheme handler. The intended use is bundling
11+
XSLT stylesheets / RNG schemas via `include_bytes!` and serving
12+
them through a synthetic scheme (e.g. `embed:///foo.xsl`), so
13+
libxslt's `xsl:import` resolution can reach the embedded bytes
14+
without touching the disk. Closures may run on any thread libxml2
15+
calls them from (`Send + Sync + 'static`).
2216

2317
## [0.3.11] (2026-05-18)
2418

0 commit comments

Comments
 (0)