diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
| @@ -31,6 +31,24 @@ zg is a modular library. This approach minimizes binary file size and memory | |||
| 31 | requirements by only including the Unicode data required for the specified module. | 31 | requirements by only including the Unicode data required for the specified module. |
| 32 | The following sections describe the various modules and their specific use case. | 32 | The following sections describe the various modules and their specific use case. |
| 33 | 33 | ||
| 34 | ### Init and Setup | ||
| 35 | |||
| 36 | The code examples will show the use of `Module.init(allocator)` to create the | ||
| 37 | various modules. All of the allocating modules have a `setup` variant, which | ||
| 38 | takes a pointer and allocates in-place. | ||
| 39 | |||
| 40 | Example use: | ||
| 41 | |||
| 42 | ```zig | ||
| 43 | test "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 | ||
| 36 | In the `code_point` module, you'll find a data structure representing a single code | 54 | In 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 | ``` |
| 407 | This has a `setupWithNormalize` variant as well, but note that this also takes | ||
| 408 | a `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 |