all: update for zig 0.14.0

Support for earlier zig versions has been dropped.
This commit is contained in:
torque 2025-03-13 21:23:12 -06:00
parent 3b5412b035
commit fbd6e7af0c
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk
4 changed files with 9 additions and 7 deletions

View File

@ -21,11 +21,11 @@ The standard workflows around publishing and subscribing to messages seem to wor
# Zig Version Support
Since the language is still under active development, any written Zig code is a moving target. The master branch targets zig `0.12`, `0.13`, and `0.14-dev` (though it is not guaranteed to work with all versions. Check the commit history for specific version updates).
Since the language is still under active development, any written Zig code is a moving target. The master branch targets zig `0.14`.
# Using
These bindings are ready-to-use with the Zig package manager. With Zig 0.13, this means you will need to create a `build.zig.zon` and modify your `build.zig` to use the dependency.
These bindings are ready-to-use with the Zig package manager. This means you will need to create a `build.zig.zon` and modify your `build.zig` to use the dependency.
```sh
# bootstrap your zig project if you haven't already

View File

@ -1,6 +1,8 @@
.{
.name = "nats_client",
.name = .nats_client,
.fingerprint = 0x7B8B5B9E2C2BD086,
.version = "0.1.0",
.minimum_zig_version = "0.14.0",
.paths = .{
"src",
"build.zig",
@ -9,8 +11,8 @@
},
.dependencies = .{
.nats_c = .{
.url = "git+https://github.com/allyourcodebase/nats.c.git?ref=3.9.1#be5a084d6e235de157e6183533b2575f413afc82",
.hash = "122052af6a8b2a226de6422b9f50140ea97e9fe27995d0aa257b7c773d41b20a414c",
.url = "git+https://github.com/allyourcodebase/nats.c.git?ref=3.9.1+1#6e6c26f0ebb63ca55913f5a60c9c762cb598b117",
.hash = "nats_c-3.9.1-0V8jnIpSAABnRZjGhKu7GzOKPWzb-JB35jspoD_AfLvm",
},
},
}

View File

@ -68,7 +68,7 @@ pub const Message = opaque {
}
pub fn getHeaderValue(self: *Message, key: [:0]const u8) Error![:0]const u8 {
var value: ?[*:0]u8 = null;
var value: [*c]const u8 = null;
const status = Status.fromInt(nats_c.natsMsgHeader_Get(@ptrCast(self), key.ptr, &value));
return status.toError() orelse std.mem.sliceTo(value.?, 0);

View File

@ -51,7 +51,7 @@ pub fn checkUserDataType(comptime T: type) void {
else => checkUserDataType(info.child),
},
pointer => |info| switch (info.size) {
.Slice => @compileError(
.slice => @compileError(
"nats callbacks can only accept void or an (optional) single, many," ++
" or c pointer as userdata, not slices. \"" ++
@typeName(T) ++ "\" appears to be a slice.",