pub fn write_dump(
path: &Path,
entries: &[(TableName, SymStr, Stored)],
) -> Result<usize, String>Expand description
Write a state diff to a dump file. Returns the number of entries successfully written.
Writes in three ordered sections, matching Perl’s
TeX_Job.pool.ltxml::DumpFile which separates
@cmds_early / @cmds / @cmds_late:
- cmds_early — M:PA / M:MPA let-aliases whose target pre-existed in the bootstrap
snapshot (e.g.
\tex_let:D → \let,\tex_def:D → \def). Applied first because their targets are always available (they’re in the bootstrap pool we loaded unconditionally before this dump). - cmds (regular) — V / M:E / M:T / R / C / LC / UC / SC / MC / DC entries: data, expandable definitions, registers, codes.
- cmds_late — M:PA / M:MPA let-aliases whose target is defined by this dump. Applied last so the target is installed before the alias fires.
The early/late split requires the caller (ini_tex) to have staged a
snapshot via state::stage_snapshot("bootstrap"). If no snapshot is
available, all aliases are emitted as late (safe — they just wait
until after regular entries).