Some checks are pending
CI / build (macos-latest, 0.13.0) (push) Waiting to run
CI / build (true, ubuntu-latest, master) (push) Waiting to run
CI / build (ubuntu-latest, 0.12.1) (push) Waiting to run
CI / build (ubuntu-latest, 0.13.0) (push) Waiting to run
CI / build (windows-latest, 0.13.0) (push) Waiting to run
NATS.c
This is the NATS C client library, packaged for Zig.
Status
This library only explicitly supports Linux, macOS, and Windows operating systems. Building for other platforms is currently untested, so your mileage may vary.
Zig Bindings
The following projects provide zig language bindings to the NATS.c library:
Usage
First, update your build.zig.zon
:
# Initialize a `zig build` project if you haven't already
zig init
# replace <refname> with the version you want to use, e.g. 3.8.2
zig fetch --save git+https://github.com/allyourcodebase/protobuf-c#<refname>
You can then import nats_c
in your build.zig
with:
const nats_c_dep = b.dependency("nats_c", .{
.target = target,
.optimize = optimize,
.@"enable-tls" = true, // enable SSL/TLS support
.@"force-host-verify" = true, // force hostname verification for TLS connections
.@"enable-streaming" = true, // build with support for NATS streaming extensions
});
your_exe.linkLibrary(nats_c_dep.artifact("nats_c"));
Dependencies
The NATS.c library has two optional dependencies:
libressl
when building withenable-tls
protobuf-c
when building withenable-streaming
These dependencies are currently automatically retrieved and compiled as static libraries by the zig build system.
Version Support Matrix
Refname | NATS.c Version | Zig 0.12.x |
Zig 0.13.x |
Zig 0.14.0-dev |
---|---|---|---|---|
3.8.2 |
3.8.2 |
✅ | ✅ | ✅ |
Languages
Zig
100%