v0.0.4 - Zig 0.16 and C ABI v3
Migration release for Zig 0.16 and the new request/context/cancellation model.
Highlights
- Minimum Zig version raised to
0.16.0. - File hashing now accepts explicit
std.Io. - Added
Contextas a reusablestd.Iowrapper for one-shot file hashing:Context.initContext.fileHashContext.fileHashInDir
- Added
HashRequestwith:hash_optionsoperation
- Added cooperative cancellation through
Operation. - Added high-level cancellable streaming API:
HashStream.initHashStream.updateHashStream.digestLengthHashStream.finalHashStream.finalResult
HashStreamnow rejectsupdate,final, andfinalResultafter
finalization witherror.InvalidState.stringHash,fileHash, andfileHashInDirnow useHashRequest.RuntimeHasherremains public as a lower-level hasher without request/cancel handling.
C ABI v3
- ABI version bumped:
ZFH_API_VERSION = 3. - C enums and mappings are generated from
tools/c_api. - Added generated header:
zig_files_hash_c_api_generated.h
- Added
zfh_requestto carry options and optional operation state. - Added explicit C context API for file hashing:
zfh_context_createzfh_context_destroyzfh_context_file_hash
- Removed the old path-only
zfh_file_hashentry point from the public C ABI. - Added in-place operation state API:
zfh_operation_state_sizezfh_operation_state_alignzfh_operation_init_inplacezfh_operation_cancel
zfh_hasher_init_inplacenow acceptsconst zfh_request*instead of
const zfh_options*.- C streaming state now wraps Zig
HashStream, sozfh_hasher_updateand
zfh_hasher_finalcan returnZFH_OPERATION_CANCELED. - Unknown
zfh_options.flagsbits are rejected asZFH_INVALID_ARGUMENT. - Error
ZFH_BUFFER_TOO_SMALLwas renamed toZFH_OUTPUT_BUFFER_TOO_SMALL.
Compatibility notes
- This is a breaking release for both Zig API and C ABI consumers.
- C consumers should regenerate bindings against
src/zig_files_hash_c_api.handsrc/zig_files_hash_c_api_generated.h. - Callers that already own file reading should prefer C streaming APIs.
- Callers that want path-based file hashing from C should create a
zfh_context.