Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit f0531ec

Browse files
author
Jason Phan
committed
readme: Fix API reference and installation
1 parent 5baa03d commit f0531ec

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
1818

1919
### Manual
2020

21-
1. Declare Getty JSON as a dependency in `build.zig.zon`. Be sure to replace `<COMMIT>` with a commit SHA.
21+
1. Declare Getty JSON as a dependency in `build.zig.zon`:
2222

2323
```diff
2424
.{
@@ -32,7 +32,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
3232
}
3333
```
3434

35-
2. Expose Getty JSON as a module by adding the following lines to `build.zig`:
35+
2. Expose Getty JSON as a module in `build.zig`:
3636

3737
```diff
3838
const std = @import("std");
@@ -41,8 +41,8 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
4141
const target = b.standardTargetOptions(.{});
4242
const optimize = b.standardOptimizeOption(.{});
4343

44-
+ const dep_opts = .{ .target = target, .optimize = optimize };
45-
+ const json_module = b.dependency("json", dep_opts).module("json");
44+
+ const opts = .{ .target = target, .optimize = optimize };
45+
+ const json_module = b.dependency("json", opts).module("json");
4646

4747
const exe = b.addExecutable(.{
4848
.name = "test",
@@ -57,7 +57,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
5757
}
5858
```
5959

60-
3. Obtain a package hash for Getty JSON (denoted below as `<HASH>`):
60+
3. Obtain Getty JSON's package hash:
6161

6262
```
6363
$ zig build
@@ -67,7 +67,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
6767
note: expected .hash = "<HASH>",
6868
```
6969

70-
4. Update `build.zig.zon` with the package hash:
70+
4. Update `build.zig.zon` with hash value:
7171

7272
```diff
7373
.{
@@ -256,7 +256,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
256256
- **Synopsis**
257257

258258
```zig
259-
fn toWriter(value: anytype, writer: anytype) !void
259+
fn toWriter(allocator: ?std.mem.Allocator, value: anytype, writer: anytype) !void
260260
```
261261

262262
- **Example**
@@ -273,7 +273,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
273273
const stdout = std.io.getStdOut().writer();
274274

275275
// {"x":1,"y":2}
276-
try json.toWriter(point, stdout);
276+
try json.toWriter(null, point, stdout);
277277
}
278278
```
279279
</details>
@@ -284,7 +284,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
284284
- **Synopsis**
285285

286286
```zig
287-
fn toPrettyWriter(value: anytype, writer: anytype) !void
287+
fn toPrettyWriter(allocator: ?std.mem.Allocator, value: anytype, writer: anytype) !void
288288
```
289289

290290
- **Example**
@@ -304,7 +304,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
304304
// "x": 1,
305305
// "y": 2
306306
// }
307-
try json.toPrettyWriter(point, stdout);
307+
try json.toPrettyWriter(null, point, stdout);
308308
}
309309
```
310310
</details>
@@ -315,7 +315,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
315315
- **Synopsis**
316316

317317
```zig
318-
fn toWriterWith(value: anytype, writer: anytype, ser: anytype) !void
318+
fn toWriterWith(allocator: ?std.mem.Allocator, value: anytype, writer: anytype, ser: anytype) !void
319319
```
320320

321321
- **Example**
@@ -348,7 +348,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
348348
const stdout = std.io.getStdOut().writer();
349349

350350
// [1,2]
351-
try json.toWriterWith(point, stdout, block);
351+
try json.toWriterWith(null, point, stdout, block);
352352
}
353353
```
354354
</details>
@@ -359,7 +359,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
359359
- **Synopsis**
360360

361361
```zig
362-
fn toPrettyWriterWith(value: anytype, writer: anytype, ser: anytype) !void
362+
fn toPrettyWriterWith(allocator: ?std.mem.Allocator, value: anytype, writer: anytype, ser: anytype) !void
363363
```
364364

365365
- **Example**
@@ -395,7 +395,7 @@ _Getty JSON_ is a (de)serialization library for the JSON data format.
395395
// 1,
396396
// 2
397397
// ]
398-
try json.toPrettyWriterWith(point, stdout, block);
398+
try json.toPrettyWriterWith(null, point, stdout, block);
399399
}
400400
```
401401
</details>

0 commit comments

Comments
 (0)