Skip to content

Commit d072b59

Browse files
committed
README: update for v0.2
1 parent f92941f commit d072b59

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
# Zigpak
22

3-
Messagepack implementation for Zig.
3+
Messagepack for Zig.
44

5-
Supported Zig 0.12 & 0.13
5+
- [API References (latest release)](https://zigpak.pages.dev/zigpak/)
6+
- [API References (master)](https://master.zigpak.pages.dev/zigpak/)
67

7-
## Usage
8+
Supported:
89

9-
Include this package and use the module "zigpak". This module include two sub fields:
10+
- Zig 0.12 (best effort)
11+
- Zig 0.13
12+
- Zig 0.14 (the master branch)
1013

11-
- `zigpak.fmt` - The tools to emit messagepack values directly
12-
- `zigpak.io` - Utilities to work with `std.io.Reader` and `std.io.Writer`.
14+
## Use In Your Project
1315

14-
`zigpak.fmt` has two kinds of writing functions and two kinds of reading functions:
16+
Use a tarball link with `zig fetch --save`. You can find it in the "Tags" page. Some versions of zig can only fetch "tar.gz" file, so you may prefer this type.
1517

16-
- `prefix*` emits the prefixing of the value. Usually the values are no need to be transformed and can be written directly.
17-
- `write*` accepts a value and writes into a buffer. The function name suffixed with `Sm` means this function uses run-time branching to reduce result size as possible.
18+
```sh
19+
zig fetch --save https://link-to-tarball
20+
```
1821

19-
- `readValue` and `.next` in `Value.LazyArray` and `Value.LazyMap` reads a value and returns in a dynamic-typed favour.
20-
- `.nextOf` in `Value.LazyArray` and `Value.LazyMap` accepts a specific type and generate code to read only the specific type. This may reduce run-time branching and affect performance.
22+
Assume the saved name is the default "zigpak". In the build script, refer the "zigpak" module in it.
23+
24+
```zig
25+
// build.zig
26+
27+
pub fn build(b: *std.Build) void {
28+
// ...
29+
const exe: *std.Build.Compile;
30+
31+
const zigpak = b.dependency("zigpak", .{
32+
.target = target,
33+
.optimize = optimize,
34+
}).module("zigpak");
35+
36+
exe.root_module.addImport("zigpak", zigpak);
37+
}
38+
```
2139

2240
## License
2341

2442
Apache-2.0
25-

0 commit comments

Comments
 (0)