Adapt codebase to breaking API changes in Zig 0.16.0-dev:
std.Io introduction:
- std.io namespace renamed to std.Io (capitalization)
- std.http.Client now requires io field
- Create std.Io.Threaded at entry points, pass io to functions
- Use std.Io.Writer.fixed() for fixed buffer writers
- Use std.Io.Dir.cwd().access(io, ...) for file access checks
Sleep API:
- std.Thread.sleep / std.time.sleep removed
- Use std.posix.nanosleep(seconds, nanoseconds) instead
JSON API:
- std.json.stringify() -> std.json.Stringify.value()
Time API:
- std.time.nanoTimestamp() removed
- Use std.time.Instant.now() with .since() for durations
File API:
- readFileAlloc parameter order changed, uses std.Io.Limit
Debug API:
- std.debug.writeStackTrace signature changed (removed debugInfo)
- Capture traces by pointer with |*trace| pattern
Refactored Io pattern in tests/examples to create Threaded once
at entry points and pass io: std.Io to helper functions, following
Zig's new convention of treating Io like allocators.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Make `get`, `post`, ... methods optional. Check whether these method
exist at comptime. When no corresponding method is provided,
the handler simply return immediately.
Since it uses comptime, hopefully it should not add any checks at
runtime.
zap.Endpont.Listener and zap.App now support on_error callbacks:
zap.Endpont.Listener.Settings contains an `on_error` optional callback
field.
zap.App supports those two callbacks:
/// ```zig
/// const MyContext = struct {
/// // You may (optionally) define the following global handlers:
/// pub fn unhandledRequest(_: *MyContext, _: Allocator, _: Request) anyerror!void {}
/// pub fn unhandledError(_: *MyContext, _: Request, _: anyerror) void {}
/// };
/// ```
The `endpoint` example has been updated to showcase `on_error`, and the
new example `app_errors` showcases `Context.unhandledError`.
This should produce more usable error messages. The error messages before
this were pointing at zap runtime functions, instead of at the code that
produced the error.