Skip to content

softprops/uri-template

Repository files navigation

zig uri template

Zig library for URI Templating

Main License Info Release Zig Support

examples

See examples directory

πŸ“Ό installing

Create a new exec project with zig init then update build.zig.zon by running.

zig fetch --save https://github.com/softprops/uri-template/archive/refs/tags/v0.1.1.tar.gz

you can also depend any tag with https://github.com/softprops/uri-template/archive/refs/tags/v{version}.tar.gz or current main with https://github.com/softprops/uri-template/archive/refs/heads/main/main.tar.gz. to resolve a hash omit it and let zig tell you the expected value.

Add the following in your build.zig file

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});

    const optimize = b.standardOptimizeOption(.{});
    // πŸ‘‡ de-reference dep from build.zig.zon
+    const uritemplate = b.dependency("uritemplate", .{
+        .target = target,
+        .optimize = optimize,
+    }).module("uritemplate");
    var exe = b.addExecutable(.{
        .name = "your-exe",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,
    });
    // πŸ‘‡ add the module to executable
+    exe.root_mode.addImport("uritemplate", uritemplate);

    b.installArtifact(exe);
}

πŸ₯Ή for budding ziglings

Does this look interesting but you're new to zig and feel left out? No problem, zig is young so most us of our new are as well. Here are some resources to help get you up to speed on zig

- softprops 2024

About

a zig uri template (rfc6570) implementation

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages