Skip to content

Release v0.6.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 23 Mar 23:47

ZAP Release v0.6.0

Updates

Breaking change in zap.Router

Latest zig master does not allow for multiple copies of the same anonymous type anymore. This broke zap.RequestHandler used by zap.Router.

So I rewrote zap.Router and zap.RequestHandler is gone.

To keep the APIs identical for both zig versions, I applied the rewrite patch also to the zig 0.11.0 (master) branch.

From a user perspective not much changed:

  • for unbound route handlers, use zap.Router.handle_route_unbound.
  • use zap.Router.on_request_handler() to get the request function to pass to a Listener.

Note: the 0.12.0 branch is currently broken with regard to tests due to changes in std.http.

Changelog in alphabetical order:

GitHub Action (1):
Update README

Rene Schallner (2):
trying to add mastercheck badge to README
re-write of zap.Router, fix #83

Using it

To use in your own projects, put this dependency into your build.zig.zon:

        // zap v0.6.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.6.0.tar.gz",
            .hash = "1220a5a1e6b18fa384d8a98e5d5a25720ddadbcfed01da2e4ca55c7cfb3dc1caa62a",
        }

Here is a complete build.zig.zon example:

.{
    .name = "My example project",
    .version = "0.0.1",

    .dependencies = .{
        // zap v0.6.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.6.0.tar.gz",
            .hash = "1220a5a1e6b18fa384d8a98e5d5a25720ddadbcfed01da2e4ca55c7cfb3dc1caa62a",
        }
    }
}

Then, in your build.zig's build function, add the following before exe.install():

    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
    });
    exe.addModule("zap", zap.module("zap"));
    exe.linkLibrary(zap.artifact("facil.io"));