Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

feat!: Zig 0.16 migration (std.Io API; BREAKING)#24

Merged
N283T merged 2 commits into
mainfrom
feature/zig-0.16-migration
Apr 26, 2026
Merged

feat!: Zig 0.16 migration (std.Io API; BREAKING)#24
N283T merged 2 commits into
mainfrom
feature/zig-0.16-migration

Conversation

@N283T

@N283T N283T commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adapt to Zig 0.16's unified I/O interface (std.Io).
  • All reader/writer entry points (XtcReader.open, XtcWriter.open, TrrReader.open, TrrWriter.open) gain a new first parameter io: std.Io.
  • converter and benchmark migrated to the pub fn main(init: std.process.Init) convention.
  • Bump minimum_zig_version 0.15.2 → 0.16.0; package version 0.2.0 → 0.3.0.

Breaking change

Callers must thread io through the API. Obtain it from std.process.Init.io in main, or use std.testing.io in tests.

// Before (0.2.x)
var reader = try XtcReader.open(allocator, "traj.xtc");

// After (0.3.0)
var reader = try XtcReader.open(io, allocator, "traj.xtc");

CHANGELOG.md has the full migration note.

Internal API mapping

0.15.x 0.16
std.heap.GeneralPurposeAllocator std.heap.DebugAllocator
std.fs.cwd() / std.fs.File std.Io.Dir.cwd() / std.Io.File
std.io.Reader std.Io.Reader
std.process.argsAlloc std.process.Init.minimal.args.toSlice
std.time.Timer std.Io.Timestamp + Clock.awake
file.getEndPos / file.seekTo file.length(io) / Reader.seekTo

Test plan

  • zig build test — 29/29 pass
  • zig build validate — 31/31 pass
  • zig build cross-format — 32/32 pass
  • converter trr_to_xtc test_data/frame0.trr /tmp/out.xtc succeeds (501 frames)
  • CI green on GitHub Actions (Zig 0.16.0)

N283T added 2 commits April 26, 2026 16:01
Adapt to Zig 0.16's unified I/O interface (std.Io).
Public reader/writer entry points now take `io: std.Io` as first
parameter; obtain it from `std.process.Init.io` or `std.testing.io`.

Internal changes:
- std.fs.File / std.fs.cwd  -> std.Io.File / std.Io.Dir.cwd
- std.io.Reader             -> std.Io.Reader
- std.heap.GeneralPurposeAllocator -> std.heap.DebugAllocator
- std.process.argsAlloc     -> std.process.Init.minimal.args.toSlice
- std.time.Timer            -> std.Io.Timestamp / Clock.awake
- file.getEndPos / seekTo   -> file.length(io) / Reader.seekTo
- main signature -> pub fn main(init: std.process.Init) !void
- xdrfile_xtc.zig: classify natoms <= 0 in header as
  InvalidAtomCount instead of generic ReadError
- xdrfile_xtc.zig / xdrfile_trr.zig: clarify why we rewind
  the reader after probing the header for natoms
- CHANGELOG: list missing internal API changes
  (getEndPos, seekTo, std.time.Timer) and extend the
  migration example to cover writers
- README: show how converter accesses argv via
  init.minimal.args.toSlice(init.arena.allocator())
@N283T N283T merged commit d338ba4 into main Apr 26, 2026
1 check passed
@N283T N283T deleted the feature/zig-0.16-migration branch April 26, 2026 08:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant