summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-04-30 16:48:07 -0400
committerGravatar Sam Atman2025-04-30 16:48:07 -0400
commitd2d42bf3ef5490f6fdec73508c2493a666ecee41 (patch)
tree377794be59ece4118ca2449b705b8e7cc646abc0 /README.md
parentUpdate README.md to new API (diff)
downloadzg-d2d42bf3ef5490f6fdec73508c2493a666ecee41.tar.gz
zg-d2d42bf3ef5490f6fdec73508c2493a666ecee41.tar.xz
zg-d2d42bf3ef5490f6fdec73508c2493a666ecee41.zip
Setup variants for all allocating modules
This harmonizes the allocating modules in a couple of ways. All can now be constructed by pointer, and all treat various miscellaneous read failures as `unreachable`, which indeed they should be. The README has been updated to inform users of this option.
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index 80e544f..538a38d 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,24 @@ zg is a modular library. This approach minimizes binary file size and memory
31requirements by only including the Unicode data required for the specified module. 31requirements by only including the Unicode data required for the specified module.
32The following sections describe the various modules and their specific use case. 32The following sections describe the various modules and their specific use case.
33 33
34### Init and Setup
35
36The code examples will show the use of `Module.init(allocator)` to create the
37various modules. All of the allocating modules have a `setup` variant, which
38takes a pointer and allocates in-place.
39
40Example use:
41
42```zig
43test "Setup form" {
44 var graphemes = try allocator.create(Graphemes);
45 defer allocator.destroy(graphemes);
46 try graphemes.setup(allocator);
47 defer graphemes.deinit(allocator);
48}
49```
50
51
34## Code Points 52## Code Points
35 53
36In the `code_point` module, you'll find a data structure representing a single code 54In the `code_point` module, you'll find a data structure representing a single code
@@ -386,6 +404,8 @@ test "Initialize With a Normalize" {
386 defer case_fold.deinit(allocator); 404 defer case_fold.deinit(allocator);
387} 405}
388``` 406```
407This has a `setupWithNormalize` variant as well, but note that this also takes
408a `Normalize` struct, and not a pointer to it.
389 409
390 410
391## Display Width of Characters and Strings 411## Display Width of Characters and Strings